Jump to content
  • 0

Friend Warper Map restriction


Question

Posted

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!

6 answers to this question

Recommended Posts

  • 0
Posted

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;
  • 0
Posted

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

  • 1
Posted

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.

  • 0
Posted (edited)

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
  • 1
Posted

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.

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