PDA

View Full Version : Show all admins online


HondaCBR
31/12/2011, 06:50 PM
Hello, I want to make list of admins command, if you are an admin you are PlayerInfo[playerid][pGmL] >= 1. How can I list every single connected player in a dialog, I thought it will be easy but then I thought how am I going to format each online admin in to different line in the dialog, so I need help.

if(strcmp(cmd, "/a", true) == 0)
if(strcmp(cmd, "/a", true) == 0)
{
new text12[256];
new option1[128];
if(PlayerInfo[playerid][pGmL] >= 1)
{
format(option1,sizeof(option1),"%s",WHAT HERE);
format(text12,sizeof(text12),"%s\n%s",option1,option2);
ShowPlayerDialog(playerid, 0504, DIALOG_STYLE_LIST, "Admins:", text12, "", "Ok");
}
}

And the thing im struggling with is that it needs to be global, I cant use PlayerInfo[playerid], insted of palyerid it needs to check, so can someone help me do this..

PlayHard
31/12/2011, 06:57 PM
I'll give you the one in my script and study it :). I use YCMD!

YCMD:admins(playerid, params[])
{
if(gPlayerLoggedIn[playerid] == 0) return 1;

SendClientMessage(playerid, 0x1FFFFFF, "Administrators online:");
foreach(Player, i)
{
new level[128], string[128];

if(PlayerInfo[i][Admin] > 0)
{
switch(PlayerInfo[i][Admin])
{
case 1: level = ""adminlevel1" (1)";
case 2: level = ""adminlevel2" (2)";
case 3: level = ""adminlevel3" (3)";
case 4: level = ""adminlevel4" (4)";
case 5: level = ""adminlevel5" (5)";
}
format(string, sizeof(string), "%s %s", level, PlayerName(i));
SendClientMessage(playerid, 0xFFF84FFFF, string);
}
}
return 1;
}

#define adminlevel1 "Trial Admin"
#define adminlevel2 "Junior Admin"
#define adminlevel3 "Major Admin"
#define adminlevel4 "Head Admin"
#define adminlevel5 "Owner"

*Using foreach include :).
:)

HondaCBR
31/12/2011, 07:17 PM
I guess I could make one using text, but the one I want is using dialogs, And I don't know how to format it and how many formats to do as I dont know how many admins will be online.

KiiD
05/04/2013, 02:36 AM
Thanks for that, & sorry for the bump :P