SA-MP Forums Archive
Player loop - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Player loop (/showthread.php?tid=531593)



Player loop - Derexi - 13.08.2014

I have a loop in a command that loops through all the players online to see if they're an admin, but I want it to tell the command user if there are no admins online. How would I do this?


Re: Player loop - MBilal - 13.08.2014

wt u need can u explain /admins cmd?


Re: Player loop - IceBilizard - 13.08.2014

take a example of this code

pawn Code:
CMD:admins(playerid,params[])
{
    new count = 0;
    new string[128],name[50];
    new name1[MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            GetPlayerName(i,name1,MAX_PLAYER_NAME);
            if(IsPlayerAdmin(i)) // change to your admins
            {
                {name = "{9900CC}Server Owner";}
                format(string, 128, "%s - %s", name1,name);
                SendClientMessage(playerid, COLOR_WHITE, string);
                count++;
            }
        }
    }
    if (count == 0)
    SendClientMessage(playerid,COLOR_GREY,"There are no Admins Online at the moment");
    return 1;
}