01.05.2014, 20:29
Hello folks
I'm scripting a command for players to show online admins.
Concept:
If a player does /admins it shows a list of all the admins online and whether they're on Admin duty or not.
Problem:
If another player logs in to the server he is also visible in the list.
Help is much appreciated!
Sincerely,
Bible
I'm scripting a command for players to show online admins.
Concept:
If a player does /admins it shows a list of all the admins online and whether they're on Admin duty or not.
Problem:
If another player logs in to the server he is also visible in the list.
pawn Код:
CMD:admins(playerid, params[])
{
if(!gPlayerLogged[playerid]) return SCM(playerid, COLOR_GREY, NOTLOGGED);
if(IsPlayerConnected(playerid))
{
SCM(playerid, COLOR_LBLUE, " ");
SCM(playerid, COLOR_LBLUE, "----------| Online Admins |----------");
for(new i = 0; i < MAX_ADMINS; i++)
{
if(IsPlayerConnected(i))
{
new aname[48], atitle[48], string[128];
if(PlayerInfo[i][pAdmin] == 5) { atitle = "Lead Administrator"; }
if(PlayerInfo[i][pAdmin] == 4) { atitle = "Senior Administrator"; }
if(PlayerInfo[i][pAdmin] == 3) { atitle = "Administrator"; }
if(PlayerInfo[i][pAdmin] == 2) { atitle = "Junior Administrator"; }
if(PlayerInfo[i][pAdmin] == 1) { atitle = "Helper"; }
GetPlayerName(i, aname, sizeof(aname));
if(!AdminDuty[i])
{
format(string, sizeof(string), "[*] [%s] %s (Admin duty: No)", atitle, aname);
SendClientMessage(playerid, COLOR_LBLUE, string);
}
else
{
format(string, sizeof(string), "[*] [%s] %s (Admin duty: Yes)", atitle, aname);
SendClientMessage(playerid, COLOR_LBLUE, string);
}
continue;
}
}
}
return 1;
}
Sincerely,
Bible