Basic command.. probabbly blinding obvious error
#1

The command:
Код:
 	if (strcmp("/admins", cmdtext, true, 10) == 0)
  	{
    new string[256];
    for(new i = 0; i < MAX_PLAYERS; i++)
		{
		if(IsPlayerConnected(i))
		 {
      if(Level[i] == 1)
       {
       GetPlayerName(i, sendername, sizeof(sendername));
      	 format(string, 256, "Administrator: %s",sendername);
       SendClientMessage(playerid, COLOR_WHITE, string);
       }
		 }
	  }
	}
The aim of the command: To display all online administrators

The issue: Compiles, but the command just says SERVER: Unknown Command, also, the server executable spits out this warning: SCRIPT: Bad parameter count (Count is 8, Should be 4)
SCRIPT: Bad parameter count (Count is 8, Should be 4)

I'm sure the issue here is blindingly obviously, any help is appreciated.

Regards,
~Aim
Reply
#2

to solve the Unknown Command just add a return true
pawn Код:
if (strcmp("/admins", cmdtext, true) == 0)
    {
        new string[128]; //Tip: read the topic about string length by ******
        for(new i; i < MAX_PLAYERS; i++) //you dont need to declare i as 0 because all values in pawn are at creating 0
        {
            if(IsPlayerConnected(i))
            {
                if(Level[i] == 1)
                {
                    if(!string[0]) SendClientMessage(playerid, COLOR_WHITE, "========== Admins On‌line ==========");
                    GetPlayerName(i, string, MAX_PLAYER_NAME);
                    format(string, sizeof string, "Administrator: %s", string);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                }
            }
        }
        return true; //if you return false (that happens when you dont put a return at the end of a command) the text Unknown Command will appear
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)