/getall Command bug
#1

Hello, Why When i type this command and spamming me its messages a lot?

Code:
pawn Код:
COMMAND:getall(playerid, params[])
{
    new string[128], adminname[MAX_PLAYER_NAME];
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0xFF0000AA, "You Are Not A Master Moderator Or Higher Rank!");
    foreach(Player, i)
    {
    i =! playerid;
    if(!IsPlayerConnected(i) || i == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "No One Is Connected To Be Teleported!");
    GetPlayerName(playerid, adminname, MAX_PLAYER_NAME);
    if(PlayerInfo[playerid][pAdmin] > 0)
    {
          switch(PlayerInfo[playerid][pAdmin])
          {
          case 1: AdmRank = "Trial Moderator";
          case 2: AdmRank = "Moderator";
          case 3: AdmRank = "Master Moderator";
          case 4: AdmRank = "Trial Administrator";
          case 5: AdmRank = "Administrator";
          case 6: AdmRank = "Master Administrator";
          case 7: AdmRank = "Head Administrator";
          case 8: AdmRank = "Trusted Administrator";
          case 9: AdmRank = "Co-Owner";
          case 10: AdmRank = "Owner";
          }
          format(string, sizeof(string), "The {FF0000}%s {FFA600}%s (%d) {00FF1E}Has Teleported All Players To His Position.",AdmRank, adminname, playerid);
          SendClientMessage(i, 0x00FF1EFF, string);
          SendClientMessage(playerid,0xFFEA00AA,"You Have Successfully Teleported All Players To Your Position.");
          SetPlayerInterior(i,GetPlayerInterior(playerid));
          new Float:TPX, Float:TPY, Float:TPZ;
          GetPlayerPos(playerid, TPX, TPY, TPZ);
          SetPlayerPos(i, TPX, TPY+1, TPZ);
          if(IsPlayerInAnyVehicle(i)) SetVehiclePos(GetPlayerVehicleID(i), TPX+2,TPY+2,TPZ) , PutPlayerInVehicle(i, GetPlayerVehicleID(i), 0);
    }
    if(PlayerInfo[i][pAdmin] > 0)
    {
          i = playerid;
          format(string, sizeof(string), "[ADM] The {FF0000}%s {FF5900}%s (%d) Has Teleported All Players To His Position.",AdmRank, adminname, playerid), SendClientMessage(i, 0xFF5900FF, string);
          print(string);
    }
    }
    return 1;
}
Reply
#2

pawn Код:
COMMAND:getall(playerid, params[])
{
    new string[128], adminname[MAX_PLAYER_NAME];
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, 0xFF0000AA, "You Are Not A Master Moderator Or Higher Rank!");
    if(PlayerInfo[playerid][pAdmin] > 0)
    {
        switch(PlayerInfo[playerid][pAdmin])
        {
            case 1: AdmRank = "Trial Moderator";
            case 2: AdmRank = "Moderator";
            case 3: AdmRank = "Master Moderator";
            case 4: AdmRank = "Trial Administrator";
            case 5: AdmRank = "Administrator";
            case 6: AdmRank = "Master Administrator";
            case 7: AdmRank = "Head Administrator";
            case 8: AdmRank = "Trusted Administrator";
            case 9: AdmRank = "Co-Owner";
            case 10: AdmRank = "Owner";
        }
        format(string, sizeof(string), "The {FF0000}%s {FFA600}%s (%d) {00FF1E}Has Teleported All Players To His Position.",AdmRank, adminname, playerid);
        SendClientMessageToAll(0x00FF1EFF, string);
        SendClientMessage(playerid,0xFFEA00AA,"You Have Successfully Teleported All Players To Your Position.");
        foreach(Player, i)
        {
            new Float:TPX, Float:TPY, Float:TPZ;
            i =! playerid;
            if(!IsPlayerConnected(i) || i == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "No One Is Connected To Be Teleported!");
            GetPlayerName(playerid, adminname, MAX_PLAYER_NAME);
            SetPlayerInterior(i,GetPlayerInterior(playerid));
            GetPlayerPos(playerid, TPX, TPY, TPZ);
            SetPlayerPos(i, TPX, TPY+1, TPZ);
            if(IsPlayerInAnyVehicle(i)) SetVehiclePos(GetPlayerVehicleID(i), TPX+2,TPY+2,TPZ) , PutPlayerInVehicle(i, GetPlayerVehicleID(i), 0);
        }
    }
    return 1;
}
Try that.
Reply
#3

Try This

pawn Код:
CMD:getall(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 6) {
        CMDMessageToAdmins(playerid,"GETAll");
        new Float:x,Float:y,Float:z, interior = GetPlayerInterior(playerid);
        GetPlayerPos(playerid,x,y,z);
        for(new i = 0; i < MAX_PLAYERS; i++) {
            if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
                PlayerPlaySound(i,1057,0.0,0.0,0.0); SetPlayerPos(i,x+(playerid/4)+1,y+(playerid/4),z); SetPlayerInterior(i,interior);
            }
        }
        new string[128]; format(string,sizeof(string),"Administrator \"%s\" has teleported all players", pName(playerid) );
        return SendClientMessageToAll(blue, string);
    } else return SendClientMessage(playerid,red,"ERROR: You need to be level 6 to use this command");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)