/admins commands problems
#1

Hello, There is a problem with my /admins command.

When i do /admins, and there is more admins online. It spams them. Like it opens a new window.

Here is my /admins command

pawn Код:
if(strcmp(cmd, "/admins", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[i][pAdmin] >= 1)
                    {
                        new adminstext[64];
                        SendClientMessage(playerid, COLOR_YELLOW5,"__________________________________________________________");
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW5,"                   *** Administration Team:     ");
                        if(PlayerInfo[i][pAdmin] == 1339) { adminstext = "Owner"; }
                        else if(PlayerInfo[i][pAdmin] == 1338) { adminstext = "Co-Owner"; }
                        else if(PlayerInfo[i][pAdmin] == 1337) { adminstext = "Developer"; }
                        else if(PlayerInfo[i][pAdmin] == 6) { adminstext = "Lead Admin"; }
                        else if(PlayerInfo[i][pAdmin] == 5) { adminstext = "Level 5 Adminstratior"; }
                        else if(PlayerInfo[i][pAdmin] == 4) { adminstext = "Level 4 Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 3) { adminstext = "Level 3 Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 2) { adminstext = "Level 2 Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 1) { adminstext = "Level 1 Administrator"; }
                        SendClientMessage(playerid, COLOR_YELLOW5,"__________________________________________________________");
                        GetPlayerName(i, sendername, sizeof(sendername));
                        if(AdminDuty[i] == 0)
                        {
                            format(string, 256, "%s: %s (Off Duty)", sendername, adminstext);
                            SendClientMessage(playerid, COLOR_LIGHTYELLOW5, string);
                        }
                        else
                        {
                            format(string, 256, "%s: %s (on duty)", sendername, adminstext);
                            SendClientMessage(playerid, TEAM_VAGOS_COLOR, string);
                        }
                    }
                }
            }
        }
        return 1;
    }
This is what happends:

ImagesHack Pictures

Anyone know how to solve this?
Reply
#2

Put the lines like "_____________________________" and " ** Administrator team" etc OUTSIDE the loop.
Only use the loop for the lines where the player names and ID will show. Else you will get the whole menu for each admin online.
Reply
#3

Why didnt i think of that ^_^ Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)