08.01.2014, 15:09
Your methods will not work anyways, you're only showing if the player typing the command is the admin.
This code, loops through the players to check that he/she is admin, if so it'll display them to the user. I've used some stock functions to display the rank and the name, just to save space:
EDIT:
GetPlayerName(pName); - this is wrong. GetPlayerName has 3 parameters you must fill:
GetPlayerName(playerid, const name[], len);
This code, loops through the players to check that he/she is admin, if so it'll display them to the user. I've used some stock functions to display the rank and the name, just to save space:
pawn Code:
CMD:admins(playerid, params[])
{
new count = 0, string[164];
SendClientMessage(playerid, -1, "Admins Online");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdminLevel] >= 1)
{
format(string, sizeof(string), "%s %s (ID: %d)", AdminRankName(i), getName(i), i);
SendClientMessage(playerid, -1, string);
count++;
}
}
if(count == 0)
{
SendClientMessage(playerid, -1, "There are no administrators online.");
}
}
stock AdminRankName(playerid)
{
new astring[28];
switch(PlayerInfo[playerid][pAdminLevel])
{
case 1: format(astring, sizeof(astring), "Admin Level 1");
case 2: format(astring, sizeof(astring), "Admin Level 2");
case 3: format(astring, sizeof(astring), "Admin Level 3");
case 4: format(astring, sizeof(astring), "Admin Level 4");
case 5: format(astring, sizeof(astring), "Admin Level 1338");
case 6: format(astring, sizeof(astring), "Admin Level 1999");
case 7: format(astring, sizeof(astring), "Admin Level 2000");
case 8: format(astring, sizeof(astring), "Admin Level 2013");
case 9: format(astring, sizeof(astring), "Admin Level 2014");
}
return astring;
}
stock getName(playerid)
{
new a[MAX_PLAYER_NAME +1];
GetPlayerName(playerid, a, sizeof(a));
return a;
}
GetPlayerName(pName); - this is wrong. GetPlayerName has 3 parameters you must fill:
GetPlayerName(playerid, const name[], len);