Team Teleportation
#1

pawn Код:
CMD:tpallmotherfuckers(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        for(new i=0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && gTeam[i] == Motherfuckers)
            {
                new name1[MAX_PLAYER_NAME], string[256];
                GetPlayerName(playerid, name1, sizeof(name1));
                SetPlayerPos(i, x, y, z);
                SetPlayerInterior(i, GetPlayerInterior(playerid));
                SetPlayerVirtualWorld(i, GetPlayerVirtualWorld(playerid));
                format(string, sizeof(string), "%s [%d] has teleported all Motherfuckers into him.", name1, playerid);
                SendClientMessageToAll(0xFF0000FF, string);
                return 1;
            }
        }
    }
    return 1;
}
Well,when I try to use that command,it doesn't set all on the pos.
Reply
#2

Because you put return 1 in the loop, plus it would spam MAX_PLAYER times the message.

pawn Код:
CMD:tpallmotherfuckers(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
        new Float:x, Float:y, Float:z, name1[MAX_PLAYER_NAME], string[80];
        GetPlayerName(playerid, name1, sizeof(name1));
        format(string, sizeof(string), "%s [%d] has teleported all Motherfuckers into him.", name1, playerid);
        SendClientMessageToAll(0xFF0000FF, string);
        GetPlayerPos(playerid, x, y, z);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && gTeam[i] == Motherfuckers)
            {
                SetPlayerPos(i, x, y, z);
                SetPlayerInterior(i, GetPlayerInterior(playerid));
                SetPlayerVirtualWorld(i, GetPlayerVirtualWorld(playerid));
            }
        }
    }
    return 1;
}
Reply
#3

Oh,yes. I didnt notice that lol. Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)