/admins command
#7

pawn Код:
if (strcmp(cmd, "/admins", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            SendClientMessage(playerid, COLOR_WHITE, " ");
            SendClientMessage(playerid, COLOR_WHITE, "||~||..::{FF0000}Los Angeles RP Admins{FFFFFF}::..||~||");
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
            if(PlayerInfo[i][pAdmin] != 0) 
                    {
                        new admtext[64];
                         if(PlayerInfo[i][pAdmin] == 10000) { admtext = "Owner"; }
                        else if(PlayerInfo[i][pAdmin] == 99999) { admtext = "Server Manager"; }
                        else if(PlayerInfo[i][pAdmin] == 1337) { admtext = "Head Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 4) { admtext = "High Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 3) { admtext = "Senior Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 2)    { admtext = "Junior Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 1) { admtext = "Moderator"; }
                        GetPlayerName(i, sendername, sizeof(sendername));
                        if(AdminDuty[i] == 0)
                        {
                            format(string, 256, "{FF0000}( %s ) {FFFFFF}%s ", admtext, sendername);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                        }
                        else
                        {
                            format(string, 256, "{FF0000}( %s ) {FFFFFF}%s ", admtext, sendername);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                        }
                    }
                }
            }
        }
        return 1;
    }
The if(PlayerInfo[i][pAdmin] != 0) checks if the player is an admin before processing all that code, will also be faster becuase then for non admin players it doesn't have to process all that.
Reply


Messages In This Thread
/admins command - by DannySnoopy - 06.08.2011, 21:18
Re: /admins command - by 0_o - 06.08.2011, 21:20
Re: /admins command - by DannySnoopy - 06.08.2011, 21:23
Re: /admins command - by 0_o - 06.08.2011, 21:28
Re: /admins command - by DannySnoopy - 06.08.2011, 21:29
Re: /admins command - by 0_o - 06.08.2011, 21:32
Re: /admins command - by dowster - 06.08.2011, 21:34
Re: /admins command - by DannySnoopy - 06.08.2011, 21:39

Forum Jump:


Users browsing this thread: 2 Guest(s)