Jump to content

Question

Posted

Script works if command is issued via @warp prontera 123 123

 

However is I tried to warp with comma like @warp prontera,123,123 then an issue exist. may I ask to help fix the written script. Thanks!

-	script	war_pay	-1,{
OnInit:
bindatcmd "warp",strnpcinfo(3)+"::OnWarpCommand";
end;
OnWarpCommand:
	.@command$ = strtolower(.@atcmd_parameters$[0]);
	dispbottom "It cost you 1,000 zeny to warp.";
	if(.@atcmd_numparameters == 1 || .@atcmd_numparameters == 3){
		if ( Zeny > 1000 ){
			set Zeny, Zeny - 1000;
			warp .@command$,atoi(.@atcmd_parameters$[1]),atoi(.@atcmd_parameters$[2]);
			end;
		} 
		if ( Zeny < 1000 ){
			dispbottom "Can't warp you. You don't have zeny.";
			end;
		}
	}

	
}


 

Error as seen below when using @warp with comma.

[Warning]: (mapindex_normalize_name) Map name '                prontera,123,123' is too long!
[Debug]: (buildin_warp) mapindex_name2id: Map "prontera,12" not found in index list!
[Debug]: pc_setpos: Passed mapindex(0) is invalid!
[Error]: buildin_warp: moving player 'awesome' to "prontera,123,123",0,0 failed.
 

1 answer to this question

Recommended Posts

  • 0
Posted

try this

-	script	war_pay	-1,{
OnInit:
bindatcmd "warp",strnpcinfo(3)+"::OnWarpCommand";
end;
OnWarpCommand:
	if(.@atcmd_numparameters != 1 && .@atcmd_numparameters != 3){
		dispbottom "@warp Failed.";
		dispbottom "@warp <map_name> <x> <y>";
		dispbottom "@warp <map_name>,<x>,<y>";
		end;
	}

	.@command$ = strtolower(.@atcmd_parameters$[0]);
	.@x = atoi(.@atcmd_parameters$[1]);
	.@y = atoi(.@atcmd_parameters$[2]);
	if(.@atcmd_numparameters == 1){
		if(compare(.@command$,",")){
			explode(.@info$, .@command$, ",");
			.@command$ = .@info$[0];
			.@x = atoi(.@info$[1]);
			.@y = atoi(.@info$[2]);
		}
	}
	dispbottom "It cost you 1,000 zeny to warp.";
	if ( Zeny > 1000 ){
		set Zeny, Zeny - 1000;
			warp .@command$,.@x,.@y;
		end;
	}
	dispbottom "Can't warp you. You don't have zeny.";
	end;
}

 

  • Love 1

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...