/admins command doesnt work
#1

Someone tell me whats wrong, Complies no errors but doesnt show admins.
Quote:

if (strcmp(cmd, "/admins", true) == 0)
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_YELLOW, "[ ! ] List of online adminstrators");
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] < 4)
{
new admtext[64];
if(PlayerInfo[playerid][pAdmin] == 4) { admtext = "level 4"; }
else if(PlayerInfo[playerid][pAdmin] == 3) { admtext = "level 3"; }
else if(PlayerInfo[playerid][pAdmin] == 2) { admtext = "level 2"; }
else if(PlayerInfo[playerid][pAdmin] == 1) { admtext = "level 1"; }
else { admtext = "level 1"; }
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "%s %s", sendername,admtext);
SendClientMessage(playerid, COLOR_ADMIN, string);
}
}
}
}
return 1;
}

Reply
#2

It actually shows to each player his admin level.
Try this:
pawn Код:
if (strcmp(cmd, "/admins", true) == 0)
  {
     SendClientMessage(playerid, COLOR_YELLOW, "[ ! ] List of online adminstrators");
     for (new i; i < MAX_PLAYERS; i ++)
     {
       if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] < 4)
       {
        new
          adminname[MAX_PLAYER_NAME];
        GetPlayerName(i, adminname, MAX_PLAYER_NAME);          
         format(string, sizeof(string), "%s - level: %d", adminname, PlayerInfo[i][pAdmin]);
         SendClientMessage(playerid, COLOR_ADMIN, string);
       }
     }
     return 1;
  }
Also I guess you don't need to check whether players connected since all pInfo vars are cleared when they connect/disconnect.
Reply
#3

Still doesnt work
Reply
#4

Oh, I forgot to get admin name... check the post above
Quote:
Originally Posted by bubka3
Still doesnt work
Hm...
Reply
#5

Still I cant see myself as admin , and I think i needs 2 be defined or something
Reply
#6

Is "List of online adminstrators" message shown?
And maybe it's stupid question but I just need be sure - have you logged in as ingame admin?
If so, what is your admin level? Is it higher than 3?
Reply
#7

List of online is shown and my admin lvl is 4
Reply
#8

Fixed
Reply
#9

Then you need change
pawn Код:
&& PlayerInfo[i][pAdmin] < 4)
to
pawn Код:
&& PlayerInfo[i][pAdmin] <= 4)
or remove that part and just do
pawn Код:
if(PlayerInfo[i][pAdmin] >= 1)
----------------
Quote:
Originally Posted by bubka3
Fixed
OK

Reply
#10

Nothing to do with 0.3
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)