Jump to content
  • 0
Sign in to follow this  
Raily

Teleport all Online & Connecting Players

Question

Well, i guess this is a completely dumb question... but is there a logic way to teleport all Connecting & Online players to one Location?

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Yes, sure i ment the entire system for an NPC not as GM. (The NPC is not a visible NPC... its a function.)

Share this post


Link to post
Share on other sites
  • 0

Seems like noone has an idea how to teleport all online players to an position using an NPC w/o using @recallall.... D:

Share this post


Link to post
Share on other sites
  • 0

I think is it you want. :)

@EDIT

Little improvement applied. :)


 

-	script	warp_online_players	FAKE_NPC,{

OnInit:
	bindatcmd "warpall", strnpcinfo(3) + "::OnAtcommand", 99, 99, 0;
	setarray .warp_skip_group[0], 99; // Skip administrator group ID

	if (getarraysize($warp_online) == 0)
		setarray $warp_online[0], -1;
	end;

OnAtcommand:
	// Usage: @warpall <map name> <x> <y>
	if (.@atcmd_numparameters < 3)
		message strcharinfo(0), .@atcmd_command$ + " failed. Usage: " + .@atcmd_command$ + " <map name> <x> <y>";
	else
	{
		.@tmp = playerattached();

		for(.@i = 0; .@i < getarraysize($warp_online); .@i++)
		{
			if ($warp_online[.@i] == -1)
				continue;

			if (isloggedin($warp_online[.@i]))
			{
				if (attachrid($warp_online[.@i]))
				{
					for(.@j = 0; .@j < getarraysize(.warp_skip_group); .@j++)
					{
						if (getgroupid() >= .warp_skip_group[.@j])
							continue;

						warp .@atcmd_parameters$[0], atoi(.@atcmd_parameters$[1]), atoi(.@atcmd_parameters$[2]);
						break;
					}

					detachrid;
				}
				else
					setarray $warp_online[.@i], -1;
			}
			else
				setarray $warp_online[.@i], -1;
		}

		if (isloggedin(.@tmp))
		{
			if (attachrid(.@tmp))
				message strcharinfo(0), "All players have been warped to '" + .@atcmd_parameters$[0] + "' " + .@atcmd_parameters$[1] + "," + .@atcmd_parameters$[2] + ".";
		}
	}
	end;

OnPCLoginEvent:
	for(.@i = 0; .@i < getarraysize($warp_online); .@i++)
	{
		if ($warp_online[.@i] == -1)
		{
			setarray $warp_online[.@i], getcharid(3);
			@warp_position = .@i;
			break;
		}
	}

	if (.@i == getarraysize($warp_online))
	{
		@warp_position = getarraysize($warp_online);
		setarray $warp_online[@warp_position], getcharid(3);
	}

	end;

OnPCLogoutEvent:
	setarray $warp_online[@warp_position], -1;
	@warp_position = 0;
	end;
}

 

 

Edited by Cretino

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.