SA-MP Forums Archive
dcmd_admins shows Unknown Command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: dcmd_admins shows Unknown Command (/showthread.php?tid=136933)



dcmd_admins shows Unknown Command - Andy_McKinley - 27.03.2010

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;
}



Re: dcmd_admins shows Unknown Command - jamesbond007 - 27.03.2010

why is it return 0;?


Re: dcmd_admins shows Unknown Command - MadeMan - 27.03.2010

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


Re: dcmd_admins shows Unknown Command - Andy_McKinley - 27.03.2010

This is working correctly!
It shows:

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

How can I fix the error message?


Re: dcmd_admins shows Unknown Command - MadeMan - 27.03.2010

Did you fix MAX_PLAYERS ?


Re: dcmd_admins shows Unknown Command - Andy_McKinley - 27.03.2010

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++)



Re: dcmd_admins shows Unknown Command - Jeffry - 27.03.2010

Remove the "return 0" in your command.


Re: dcmd_admins shows Unknown Command - Andy_McKinley - 27.03.2010

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


Re: dcmd_admins shows Unknown Command - MadeMan - 27.03.2010

Do it on both

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



Re: dcmd_admins shows Unknown Command - Andy_McKinley - 27.03.2010

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.