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

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

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

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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