dcmd_admins shows Unknown Command
#1

The title says it all; cmd not working and showing SERVER: Unknown Command.
I hope someone can fix/help.

pawn Код:
dcmd_admins(playerid, params[])
{
  #pragma unused params
  print("Admins command 1");
  new adminscount = 0,string[128],adminName[MAX_PLAYER_NAME];

  for(new i=0;i<=MAX_PLAYERS;i++)
    if(pInfo[i][pAdmin] > 0 || IsPlayerAdmin(i)) adminscount ++;

  if(adminscount == 0) return SendClientMessage(playerid, COLOR_RED, "There is are Adminstrators online.");

  SendClientMessage(playerid, COLOR_LIGHTYELLOW, "Admins online:");
  print("Admins command 2");
  for(new j=0;j<=MAX_PLAYERS;j++)
  {
    if(pInfo[j][pAdmin] > 0 || IsPlayerAdmin(j))
   {
     print("Admins command 3");
     GetPlayerName(j,adminName,sizeof(adminName));
     format(string,sizeof(string),"Admin: %s [Level: %d] [ID: %d].",adminName,pInfo[j][pAdmin],j);
     SendClientMessage(playerid, COLOR_GREEN, string);
   }
   return 0;
  }
  return 1;
}
Reply
#2

why is it return 0;?
Reply
#3

Quote:
Originally Posted by jamesbond007
why is it return 0;?
Yes, and i<=MAX_PLAYERS should be i<MAX_PLAYERS
Reply
#4

This is working correctly!
It shows:

Admins Online:
[UF]DarkPhoenix [Level 1] [ID: 11].
SERVER: Unknown Command.

How can I fix the error message?
Reply
#5

Did you fix MAX_PLAYERS ?
Reply
#6

Quote:
Originally Posted by MadeMan
Did you fix MAX_PLAYERS ?
pawn Код:
for(new i=0;i<MAX_PLAYERS;i++)
pawn Код:
for(new j=0;j<=MAX_PLAYERS;j++)
Reply
#7

Remove the "return 0" in your command.
Reply
#8

Quote:
Originally Posted by Jeffry
Remove the "return 0" in your command.
I did.
Reply
#9

Do it on both

pawn Код:
for(new i=0;i<MAX_PLAYERS;i++)
pawn Код:
for(new j=0;j<MAX_PLAYERS;j++)
Reply
#10

Quote:
Originally Posted by MadeMan
Do it on both

pawn Код:
for(new i=0;i<MAX_PLAYERS;i++)
pawn Код:
for(new j=0;j<MAX_PLAYERS;j++)
Yeah, I tried it before, it works fine now! Thanks for helping.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)