/admins dialog Total online admins do help:(
#5

Quote:
Originally Posted by [MWR]Blood
Посмотреть сообщение
This is from my script...
pawn Код:
CMD:admins(playerid,params[])
{
    #pragma unused params
    new string[150],count = 0,AdminPos[30];
    for(new i = 0;i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PInfo[i][Level] >= 1)
            {
                if(PInfo[i][Level] == 1) AdminPos=""cwhite"VIP";
                else if(PInfo[i][Level] == 2) AdminPos=""cyellow"Moderator";
                else if(PInfo[i][Level] == 3) AdminPos=""cyellow"Administrator";
                else if(PInfo[i][Level] == 4) AdminPos=""cgreen"Head Administrator";
                else if(PInfo[i][Level] == 5) AdminPos=""cred"Owner";
                format(string,sizeof(string),"%s"cgreen2"%s(ID:%d) "cyellow2"- "cblue"%s \n",string,GetPName(i),i,AdminPos);
                ShowPlayerDialog(playerid,Adminsdialog,0,""cwhite"Admins Online",string,"OK","");
                count++;
            }
        }
        else if(count == 0)
        {
            ShowPlayerDialog(playerid,Adminsdialog,0,"Admins Online",""cred"No Admins Online!","OK","");
        }
    }
    return 1;
}
You can better use foreach and delete IsPlayerConnected (you don't need that anymore since 0.3 and foreach is much faster, and loops only through connected players instead of the 500 slots that may not be filled). Also use a switch statement, it's much more clearer (I don't think it would affect the speed though, but its good practice).
Reply


Messages In This Thread
/admins dialog Total online admins do help:( - by y@sin1 - 17.09.2011, 11:20
Re: /admins dialog Total online admins do help:( - by [MWR]Blood - 17.09.2011, 11:36
[MWR]Blood - by y@sin1 - 17.09.2011, 12:03
Re: /admins dialog Total online admins do help:( - by Davz*|*Criss - 17.09.2011, 12:14
Re: /admins dialog Total online admins do help:( - by playbox12 - 17.09.2011, 12:21
Re: /admins dialog Total online admins do help:( - by [MWR]Blood - 17.09.2011, 12:25
Re: /admins dialog Total online admins do help:( - by Kingunit - 17.09.2011, 12:48
Re: /admins dialog Total online admins do help:( - by y@sin1 - 17.09.2011, 12:55
Re: /admins dialog Total online admins do help:( - by Tee - 17.09.2011, 14:41
Re: /admins dialog Total online admins do help:( - by bob_dillan - 17.09.2011, 15:11

Forum Jump:


Users browsing this thread: 1 Guest(s)