Quote:
Originally Posted by Jamester
That should work exactly as intended, I don't see anything wrong. But, you could replace the if statements with a switch statement
PHP код:
switch(GetPVarInt(playerid, "AdminLevel") {
case 1..2: admtext = "Moderator";
// etc...
}
EDIT: Just looked through the loop something is wrong.
PHP код:
// you loop check print the admin etc...
return 1;
same thing with the no admins also
PHP код:
cmd(admins, playerid, params[])
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, COLOR_ADMIN, "Online Staff Members:");
new count;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPVarInt(playerid, "AdminLevel") <= 1338)
{
new admtext[64], sendername[MAX_PLAYER_NAME];
if(GetPVarInt(playerid, "AdminLevel") == 1337) { admtext = "Head Administrator"; }
if(GetPVarInt(playerid, "AdminLevel") == 4) { admtext = "Senior Administrator"; }
if(GetPVarInt(playerid, "AdminLevel") == 3) { admtext = "Administrator"; }
if(GetPVarInt(playerid, "AdminLevel") == 2) { admtext = "Moderator"; }
if(GetPVarInt(playerid, "AdminLevel") == 1) { admtext = "Moderator"; }
GetPlayerName(i, sendername, sizeof(sendername));
new tstr[128];
format(tstr, 128, "%s {FFFFFF}- %s", sendername, admtext);
SendClientMessage(playerid, COLOR_ADMIN, tstr);
count++;
}
}
}
if(count == 0)
SendClientMessage(playerid, COLOR_ADMIN, "No online staff members currently found.");
}
return 1;
}
|
Two people now appear on the list when testing (don't have more than two people available to test atm) but with different admin levels they still appear as the top one, Not sure why this is?
Any clues?
Thanks for the help.