Jump to content
  • 0

Friend Warper Map restriction


Wakabayashi

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  03/22/17
  • Last Seen:  

Hello rAthena Community. 

I would like to ask for some help.. is it possible to add a map restriction?

This is the  Friendwarper script:

prontera,167,199,6	script	Friend Warper	461,{
	deletearray .@aid[0],128;
	deletearray @aid[0],128;
	set @j,0;
	set @select$,"";
	query_sql "SELECT `friend_account` FROM `friends` WHERE `char_id` = "+getcharid(0)+"",.@aid;
	set .@num,getarraysize(.@aid);
	for(set .@i,0;.@i<.@num;set .@i,.@i+1)
		if(isloggedin(.@aid[.@i]))
		{
			set @aid[@j],.@aid[.@i];
			set @j,@j+1;
			set @select$,@select$+":"+rid2name(.@aid[.@i]);
		}
	set @menu,select(@select$)-2;
	if(isloggedin(@aid[@menu]))
	{
		getmapxy(@m$,@x,@y,0,rid2name(@aid[@menu]));
		warp @m$,@x,@y;
		set @m$,"";
		set @x,0;
		set @y,0;
		set @j,0;
		set @select$,"";
		deletearray @aid[0],128;
	}else
		mes "He isn't online.";
	close;
}

Thanks for your time!

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 1

  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   596
  • Joined:  11/25/11
  • Last Seen:  

The simplest, to restrict for only one map, is this one:

		getmapxy(@m$,@x,@y,0,rid2name(@aid[@menu]));
		if (@m$ == "prontera"){
			mes "I can't be teleport you to your friend's location!";
          		close;
       		}
		warp @m$,@x,@y;

Changing Prontera to whichever map you want to avoid teleporting the person to.

Link to comment
Share on other sites

  • 1

  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   596
  • Joined:  11/25/11
  • Last Seen:  

That highly depends on the amount of maps you want to restrict and what they have in common.

If it's just a few of them, you can do it like this:

if (@m$ == "prontera" || @m$ == "morocc" || @m$ == "izlude"){

If there's a huge list you better look into for and arrays.

Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   596
  • Joined:  11/25/11
  • Last Seen:  

Just insert a check after getting the target map.
Would need to be a verification between those two lines:

		getmapxy(@m$,@x,@y,0,rid2name(@aid[@menu]));
		warp @m$,@x,@y;
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  03/22/17
  • Last Seen:  

Thanks for the quick answer Mr. Harziel. :)

My Problem is that I don't know how to do this. Could you give me an example? I'll try this by my self.. maybe its not so hard. ^^

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  03/22/17
  • Last Seen:  

Ow.. this is great. Can I add more maps like this?

getmapxy(@m$,@x,@y,0,rid2name(@aid[@menu]));
		if (@m$ == "prontera","morocc","izlude"){
			mes "I can't be teleport you to your friend's location!";
          		close;
       		}
		warp @m$,@x,@y;

 

 

Edited by Wakabayashi
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  9
  • Reputation:   0
  • Joined:  03/22/17
  • Last Seen:  

Okay, thanks you made my day. :)

Link to comment
Share on other sites

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.

×
×
  • Create New...