30.12.2013, 12:28
help write the code to teleport all to yourself please
new Interior[MAX_PLAYERS];
new VirtualWorld[MAX_PLAYERS];
CMD:getall(playerid, params[])
{
if(IsPlayerAdmin(playerid)) // Admins only
{
new Float:X, Float:Y, Float:Z;
Interior[playerid] = GetPlayerInterior(playerid);
VirtualWorld[playerid] = GetPlayerVirtualWorld(playerid);
GetPlayerPos(playerid, X, Y, Z);
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SetPlayerPos(i, X, Y, Z);
SetPlayerInterior(i,Interior[playerid]);
SetPlayerVirtualWorld(i,VirtualWorld[playerid]);
SendClientMessage(playerid, 0x00ADFFFF, "You've teleported everyone to Your position!");
// 0x00ADFFFF {00ADFF} = aqua blue colour
}
}
}
if(!IsPlayerAdmin(playerid)) // Not Admin
{
SendClientMessage(playerid, 0xE6000000, "You're not authorized to use this command!");
// 0xE6000000 {E60000} = red colour
}
return 1;
}
// Wan
CMD:getall(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0; //have to be logged into rcon
new Float:X, Float:Y, Float:Z; // define the X. Y, Z which are used to store floats.
GetPlayerPos(playerid, X, Y, Z); //get the position of the admin
for(new i = 0; i <MAX_PLAYERS; i++) //we do a loop to go through every playerid
{
if(IsPlayerConnected(i)) //only perform if the player is connected
{
SetPlayerPos(i, X, Y, Z);//set the player's position to the admin
SendClientMessage(i, -1, "Teleported to admin."); //send a message to everyone telling them they've been teleported
}
}
}