Teleport all Online & Connecting Players

Raily

New member
Messages
14
Points
0
Emulator
Well, i guess this is a completely dumb question... but is there a logic way to teleport all Connecting & Online players to one Location?

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

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

 
You can try using addrid plugin, and then even normal warp command will do
default_biggrin.png


 
I think is it you want.
default_smile.png


@EDIT

Little improvement applied.
default_smile.png


Code:
-	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;
}
 
Last edited by a moderator:
Back
Top