SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 13/05/2013, 02:38 PM   #1
MrTinder
Big Clucker
 
Join Date: Sep 2012
Posts: 148
Reputation: 2
Default /admins in dialog

Hi i try to make my cmd /admins in dialog but it's show only 1 admin.Here's the code:

pawn Code:
CMD:admins2(playerid,params[])
{
    if(IsPlayerConnected(playerid))
    {
        new string[256];
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(PlayerInfo[i][pAdmin] > 1 && PlayerInfo[i][pHide] == 0)
                {
                        new admin[20];
                        if(PlayerInfo[i][pAdmin] == 1) { admin = "Test Admin"; }
                        else if(PlayerInfo[i][pAdmin] == 2) { admin = "Moderator"; }
                        else if(PlayerInfo[i][pAdmin] == 3) { admin = "Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 4) { admin = "Scripter"; }
                        else if(PlayerInfo[i][pAdmin] == 5) { admin = "Owner"; }
                        new sendername[MAX_PLAYER_NAME];
                        GetPlayerName(i, sendername, sizeof(sendername));
                        format(string, 256, "{00CCFF}%s: {FFFFFF}%s (ID: %d) Status:{FF0000} Online", admin, sendername, i);
                        ShowPlayerDialog(playerid, 21323123, DIALOG_STYLE_LIST, "Admin Online:", string, "Close", "");
                }
            }
        }
    }
    return 1;
}
MrTinder is offline   Reply With Quote
Old 13/05/2013, 02:41 PM   #2
Cameltoe
High-roller
 
Cameltoe's Avatar
 
Join Date: Apr 2010
Location: Norway
Posts: 1,741
Reputation: 24
Default Re: /admins in dialog

Loop through the admins then show the dialog

pawn Code:
CMD:admins2(playerid,params[])
{
    if(IsPlayerConnected(playerid))
    {
        new string[256];
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(PlayerInfo[i][pAdmin] > 0 && PlayerInfo[i][pHide] == 0)
                {
                        new admin[20];
                        if(PlayerInfo[i][pAdmin] == 1) { admin = "Test Admin"; }
                        else if(PlayerInfo[i][pAdmin] == 2) { admin = "Moderator"; }
                        else if(PlayerInfo[i][pAdmin] == 3) { admin = "Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 4) { admin = "Scripter"; }
                        else if(PlayerInfo[i][pAdmin] == 5) { admin = "Owner"; }
                        new sendername[MAX_PLAYER_NAME];
                        GetPlayerName(i, sendername, sizeof(sendername));
                        format(string, 256, "%s {00CCFF}%s: {FFFFFF}%s (ID: %d) Status:{FF0000} Online \r\n", string, admin, sendername, i);
                }
            }
        }
        ShowPlayerDialog(playerid, 21323123, DIALOG_STYLE_LIST, "Admin Online:", string, "Close", "");
    }
    return 1;
}

Something like that, not tested and not optimized!

Edit: Also change "f(PlayerInfo[i][pAdmin] > 1 && PlayerInfo[i][pHide] == 0)" -> "f(PlayerInfo[i][pAdmin] > 0 && PlayerInfo[i][pHide] == 0)" Otherwise 'test admins' won't appear.
__________________

Quote:
Originally Posted by Cameltoe View Post
Share the progress so others who are looking for the same also find's their answer.
Quote:
Originally Posted by teomakedonija View Post
ahaha i don't want
Rep++;
Cameltoe is offline   Reply With Quote
Old 13/05/2013, 02:43 PM   #3
Calabresi
Huge Clucker
 
Calabresi's Avatar
 
Join Date: Jun 2012
Location: Ottawa
Posts: 232
Reputation: 20
Default Re: /admins in dialog

You need to use ShowPlayerDialog after loop ends.

pawn Code:
CMD:admins2(playerid,params[])
{
    if(IsPlayerConnected(playerid))
    {
        new string[256];
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(PlayerInfo[i][pAdmin] > 1 && PlayerInfo[i][pHide] == 0)
                {
                        new admin[20];
                        if(PlayerInfo[i][pAdmin] == 1) { admin = "Test Admin"; }
                        else if(PlayerInfo[i][pAdmin] == 2) { admin = "Moderator"; }
                        else if(PlayerInfo[i][pAdmin] == 3) { admin = "Administrator"; }
                        else if(PlayerInfo[i][pAdmin] == 4) { admin = "Scripter"; }
                        else if(PlayerInfo[i][pAdmin] == 5) { admin = "Owner"; }
                        new sendername[MAX_PLAYER_NAME];
                        GetPlayerName(i, sendername, sizeof(sendername));
                        format(string, 256, "{00CCFF}%s: {FFFFFF}%s (ID: %d) Status:{FF0000} Online", admin, sendername, i);
                }
            }
        }
        ShowPlayerDialog(playerid, 21323123, DIALOG_STYLE_LIST, "Admin Online:", string, "Close", "");
    }
    return 1;
}
Calabresi is offline   Reply With Quote
Old 13/05/2013, 02:58 PM   #4
MrTinder
Big Clucker
 
Join Date: Sep 2012
Posts: 148
Reputation: 2
Default Re: /admins in dialog

Thanks all ^^
MrTinder is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/admins dialog bebothekillar Scripting Help 1 15/02/2013 08:30 PM
[Pedido] /admins em dialog .ThePro Português/Portuguese 2 08/01/2013 12:50 AM
[Ajuda] /admins em Dialog Hauo Português/Portuguese 7 17/08/2012 07:00 PM
/admins dialog Total online admins do help:( y@sin1 Scripting Help 10 14/01/2012 04:58 PM
Dialog /admins Tekto Help Archive 9 11/03/2011 01:23 PM


All times are GMT. The time now is 05:17 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.