[Help] Put this into DIALOG_STYLE_MSGBOX
#1

Quote:

CMD:admins(playerid, params[])
{

new IsAdmin;
SendClientMessage(playerid, COLOR_ORANGE, "---------------------ONLINE ADMINS---------------------");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerData[i][Admin] > 0)
{
if(PlayerData[i][Admin] == 1) AdminLevel = "Level: 1 [Newbie]";
if(PlayerData[i][Admin] == 2) AdminLevel = "Level: 2 [Moderator]";
if(PlayerData[i][Admin] == 3) AdminLevel = "Level: 3 [Admin]";
if(PlayerData[i][Admin] == 4) AdminLevel = "Level: 4 [Sub-Owner]";
if(PlayerData[i][Admin] == 5) AdminLevel = "Level: 5 [Owner]";
format(String, sizeof(String), "%s - %s ", Name(i), AdminLevel);
SendClientMessage(playerid, COLOR_BLUE, String);
IsAdmin ++;
}
}
if(IsAdmin == 0)
{
SendClientMessage(playerid, COLOR_ORANGE, "No online Admins!");
}
IsAdmin = 0;
return 1;
}

I'm updating my admin system a bit but I can't thing on how to make this appear as a dialog instead of chat spamming....
Reply
#2

U want put this in dialog ?
Reply
#3

Yes. This is a command to show online admins (a little obvious), I want it to appear as a dialog instead of chat lines... Like if theres 2 admins online and a player types /admins, a dialog showing their names/level will pop up.
Reply
#4

Try with this

PHP код:
CMD:admins(playeridparams[])
{
    
    
//SendClientMessage(playerid, COLOR_ORANGE, "---------------------ONLINE ADMINS---------------------");
    
for(new 0MAX_PLAYERSi++)
    {
        if(
PlayerData[i][Admin] > 0)
        {
            new 
IsAdmin;
            new 
String[64];
            new 
Name[256];
            
GetPlayerName(iNamesizeof(Name));
            if(
PlayerData[i][Admin] == 1AdminLevel "Level: 1 [Newbie]";
            if(
PlayerData[i][Admin] == 2AdminLevel "Level: 2 [Moderator]";
            if(
PlayerData[i][Admin] == 3AdminLevel "Level: 3 [Admin]";
            if(
PlayerData[i][Admin] == 4AdminLevel "Level: 4 [Sub-Owner]";
            if(
PlayerData[i][Admin] == 5AdminLevel "Level: 5 [Owner]";
            
format(Stringsizeof(String), "%s{FFFFFF}%s - %s ",StringNameAdminLevel);
            
ShowPlayerDialog(playerid1DIALOG_STYLE_MSGBOX"ONLINE ADMINS"String"Close""");
            
IsAdmin ++;
        }
    }
    if(
IsAdmin == 0)
    {
        
ShowPlayerDialog(playerid2DIALOG_STYLE_MSGBOX"ONLINE ADMINS""{FFFFFF}No online Admins!""Close""");
    }
    
IsAdmin 0;
    return 
1;

Reply
#5

pawn Код:
CMD:admins(playerid, params[])
{
    new string[1024];
    for(new i = GetPlayerPoolSize(); i > -1; i--)
        if(IsPlayerConnected(i) && PlayerData[i][Admin] > 0)
        {
            if(PlayerData[i][Admin] == 1) AdminLevel = "Level: 1 [Newbie]";
            if(PlayerData[i][Admin] == 2) AdminLevel = "Level: 2 [Moderator]";
            if(PlayerData[i][Admin] == 3) AdminLevel = "Level: 3 [Admin]";
            if(PlayerData[i][Admin] == 4) AdminLevel = "Level: 4 [Sub-Owner]";
            if(PlayerData[i][Admin] == 5) AdminLevel = "Level: 5 [Owner]";

            format(string, sizeof(string), "%s\n%s - %s", string, Name(i), AdminLevel);
        }

    if(!string[0])
        string = "{FF0000}No online Admins!";

    ShowPlayerDialog(playerid, YOUR_DIALOG_ID, DIALOG_STYLE_MSGBOX, "---------------------ONLINE ADMINS---------------------", string, "Ok", "");
    return 1;
}
Reply
#6

Jeff, your's code gives me this error:

Quote:

error 017: undefined symbol "GetPlayerPoolSize"

Reply
#7

GetPlayerPoolSize is for samp 0.3.7, replace GetPlayerPoolSize() to GetMaxPlayers()-1 or just
for(new i = 0; i < MAX_PLAYERS; i++)
Reply
#8

Right after I reply I replaced with
Quote:

for(new i = 0; i < MAX_PLAYERS; i++)

hehe (I copied from the old command). Worked just fine! Thank you (:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)