Jump to content
  • 0

bind at command for town only


Question

Posted

Hello everyone,

I would like to request a bind at command to warp into a specific place like a mall using @mall, It warps to quiz_02 but it can only be used in towns, If used anywhere else it asks the player to be in a town.

Thanks and regards,

Santafe 

5 answers to this question

Recommended Posts

  • 0
Posted (edited)
-	script	mall_command	-1,{
OnMall:
	if(getmapflag(strcharinfo(3),mf_town)){
		warp "quiz_02",0,0;
	}else{
		message strcharinfo(0),"you have to be in town to use this command";
	}
end;
OnInit:
	bindatcmd("mall",strnpcinfo(3)+"::OnMall",0,99);
}

 

Edited by sader1992
mail to mall
  • Upvote 1
  • MVP 1
  • 0
Posted

Can't test it but this should do the job

 



prontera,119,42,0	script	AtCommand::alaatcom	HIDDEN_WARP_NPC,{
	end;
	
OnWarpAsked:

	freeloop 1;
	.@continue = 1;
	for( .@i = 0; .@i<getarraysize(.townMap$) && .@continue == 1; .@i++)
	{
		if(.townMap$[.@i] == strcharinfo(3))
		{
			.@continue = 0;
		}
	}
	freeloop 0;
	
	if(.@continue == 0)
	{
		warp .warpMap$, .warpX, .warpY;
	}
	else
	{
		dispbottom "[Warp System] You must be in town to use this command";
	}	
	return 1;

OnInit:
	bindatcmd "toquiz",strnpcinfo(3)+"::OnWarpAsked";
	.warpMap$ = "quiz_02";
	.warpX = 0;
	.warpY = 0;
	setarray .townMap$[0],"prontera","geffen","alberta"; //to fill
	end;
}

 

  • Love 1
  • 0
Posted
6 hours ago, Alayne said:

Can't test it but this should do the job

 




prontera,119,42,0	script	AtCommand::alaatcom	HIDDEN_WARP_NPC,{
	end;
	
OnWarpAsked:

	freeloop 1;
	.@continue = 1;
	for( .@i = 0; .@i<getarraysize(.townMap$) && .@continue == 1; .@i++)
	{
		if(.townMap$[.@i] == strcharinfo(3))
		{
			.@continue = 0;
		}
	}
	freeloop 0;
	
	if(.@continue == 0)
	{
		warp .warpMap$, .warpX, .warpY;
	}
	else
	{
		dispbottom "[Warp System] You must be in town to use this command";
	}	
	return 1;

OnInit:
	bindatcmd "toquiz",strnpcinfo(3)+"::OnWarpAsked";
	.warpMap$ = "quiz_02";
	.warpX = 0;
	.warpY = 0;
	setarray .townMap$[0],"prontera","geffen","alberta"; //to fill
	end;
}

 

Hello, thanks for the scrip, the command works but i get this warning and debug everytime i use it :

[warning]: script:run_func:AtCommand at prontera (119,42)
[debug]: Source(NPC): AtCommand at prontera (119,42)

 

  • 0
Posted (edited)
9 hours ago, sader1992 said:

-	script	mall_command	-1,{
OnMall:
	if(getmapflag(strcharinfo(3),mf_town)){
		warp "quiz_02",0,0;
	}else{
		message strcharinfo(0),"you have to be in town to use this command";
	}
end;
OnInit:
	bindatcmd("mall",strnpcinfo(3)+"::OnMall",0,99);
}

 

oh ma gerd works like a charm ty Sader <3 

@Alayne thanks for your help too <3

Edited by Santafe

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