help teleport player
#1

help write the code to teleport all to yourself please
Reply
#2

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/tp", cmdtext, true, 2) == 0)
{
new Player, Float: MP[3];
GetPlayerPos(playerid,MP[0],MP[1],MP[2]);
for(Player=0;Player<MAX_PLAYERS,Player++)
{
if(Player!=playerid)
{
SetPlayerPos(Player,MP[0],MP[1]+1,MP[2]);
}
}
return 1;
}
return 0;
}
Reply
#3

This is going to teleport everyone on the server to Your position, virtual world and interior:

pawn Код:
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
Reply
#4

pawn Код:
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
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)