Jump to content
  • 0

Can any one please fix this script(About warper).


Question

Posted (edited)

//-------------------//
//-------NPC------//
//------------------//

new_zone01,53,113,5 script Notice Board 837,{
mes "[ PVP Notice Board ]";
mes "You can pvp in Arena, i can warp you there.";
mes "Or you can go by your self @go 30.";
menu "Warp to Arena",WArena,"Close",-;
close;

WArena:
case 0: warp "prt_are01",162,162; break;
case 1: warp "prt_are01",162,138; break;
case 2: warp "prt_are01",138,138; break;
case 3: warp "prt_are01",138,162; break;
close2;
end;

}

//-----------------------//
//------Fucntion------//
//-----------------------//

- script PVPGO30 -1,{
OnInit:
bindatcmd("go", "PVPGO30::OnGo");
end;

OnGo:
if(.@atcmd_parameters$[0] != 33){
useatcmd "@go "+.@atcmd_parameters$[0];
}
switch(rand(3)){
case 0: warp "prt_are01",161,162; break;
case 1: warp "prt_are01",161,138; break;
case 2: warp "prt_are01",138,137; break;
case 3: warp "prt_are01",137,161; break;
}
end;
}

This npc will warp the player's to 4x Coordinates by case 0 to case 3.

And also if the players press @go 30, they have to warp by 4x Coordinates by case 0 to case 3 same with npc.

Thanks in advance.

Edited by AnnieRuru
use [codebox] if the script >10 lines

4 answers to this question

Recommended Posts

Posted

prontera,155,184,5	script	Notice Board	100,{
mes "[ PVP Notice Board ]";
mes "You can pvp in Arena, i can warp you there.";
mes "Or you can go by your self @gopvp.";
if ( select( "Warp to Arena", "Close" ) == 2 ) close;
L_warp:
switch ( rand(4) ) {
	default: warp "prt_are01",162,162; break;
	case 1: warp "prt_are01",162,138; break;
	case 2: warp "prt_are01",138,138; break;
	case 3: warp "prt_are01",138,162;
}
end;
OnInit:
bindatcmd("gopvp", strnpcinfo(3)+"::OnGo");
end;
OnGo:
if ( getmapflag( strcharinfo(3), mf_nowarp ) ) {
	dispbottom "Do not abuse this command !!";
	end;
}
goto L_warp;
}

I'm quite sure if you overwrite @go like that, all the rest like @go 0 will stop to work already

better create a new one

Posted

NPC has been fixed by Cydh, i need to fix the function for warp case @go 30, since @go 30 is prt_are01 in the server.

//-----------------------//

//------Fucntion------//

//-----------------------//

- script PVPGO30 -1,{

OnInit:

bindatcmd("go", "PVPGO30::OnGo");

end;

OnGo:

if(.@atcmd_parameters$[0] != 30){

useatcmd "@go "+.@atcmd_parameters$[0];

}

switch(rand(3)){

case 0: warp "prt_are01",162,162; break;

case 1: warp "prt_are01",162,138; break;

case 2: warp "prt_are01",138,138; break;

case 3: warp "prt_are01",138,162; break;

}

end;

}

It this script give's an error in mapserver, and cant use @go for any map, example @go command itself stops working.

Thanks.

Posted

You're comparing a number with a string

if(.@atcmd_parameters$[0] != 30){

needs to be

if(.@atcmd_parameters$[0] != "30"){

You shouldn't really use useatcmd but instead redefine all the @go warp points in the scripting code. You should only use that command if it's not possible to replicate the existing @command function using script. In this case warping a player is very easily done.

Also next time please post the error you get in the mapserver as well as your code. Just saying "give's an error in mapserver" doesn't tell us much.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...