SA-MP Forums Archive
Hey, can i have a little help - 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: Hey, can i have a little help (/showthread.php?tid=542856)



Hey, can i have a little help - KyLeBlaK - 22.10.2014

Well hello, i was woundering if you guys could send me a link or even show me a code or something of how to make a /admins dialog, so i shows all the online admins, and if no admins are online then it says in the dialog "No admins online"
If you could help me i would really appreciate it


Re: Hey, can i have a little help - IceBilizard - 22.10.2014

try

pawn Код:
//At top of script
#include <zcmd>

CMD:admins(playerid, params[])
{
    #pragma unused params
    new count=0;
    new string[128],sendername[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
    {
        for (new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(pInfo[i][level] > 0) // change to your admin system
                {
                    GetPlayerName(i , sendername, sizeof(sendername));
                    format(string, sizeof(string),"Level %d: %s",pInfo[i][level], sendername);
                    ShowPlayerDialog(playerid,5,DIALOG_STYLE_MSGBOX,"Online Administrators:",string,"Ok","");
                    count++;
                }
            }
        }
        if (count == 0)
        SendClientMessage(playerid,COLOR_GREY,"There are no Admins Online at the moment");
    }
    return 1;
}



Re: Hey, can i have a little help - KyLeBlaK - 22.10.2014

That code works, but when there are no admins online it shows the name of the person who typed the command, anyway to fix that?