SERVER: Unknown Command
#1

My kick code gives me Server Unknown command.
Do you guys know what's wrong?

pawn Код:
dcmd_kick(playerid, params[])
{
    new reason;
    new string1[128];
    new string2[128];
    if(PlayerInfo[playerid][AdminLevel] < LEVEL_KICK) ErrorMessage(playerid, "Error: You don't have a high enough admin level!");
  else if (sscanf(params, "us", target, reason)) ErrorMessage(playerid, "Usage: '/kick [playerid] [reason]'");
  else if (target == INVALID_PLAYER_ID) ErrorMessage(playerid, "Error: Player not connected!");
  else if (PlayerInfo[playerid][AdminLevel] < PlayerInfo[target][AdminLevel]) ErrorMessage(playerid, "Error: Player has a higher admin level then you!");
    else
    {
    SystemMessage(playerid, "Player has been kicked!");
    format(string1, sizeof(string1), "You have been kicked by Administrator %s. (Reason: '%s')", PlayerName(playerid), reason);
    SendMessage(target, string1);
    format(string2, sizeof(string2), "Player %s has been kicked by Administrator %s. (Reason: '%s')", PlayerName(target), PlayerName(playerid), reason);
    printf(string2);
    SendClientMessageToAll(COLOR_MESSAGE, string2);
    KickPlayer(target);
    }
    return 1;
    }
Reply
#2

Under OnPlayerCommandText

Make sure you have

dcmd(kick, 4, cmdtext);

Any other value instead of 4 will cause the server to return UNKNOWN COMMAND,
Just count how many characters are in your command ( kick ) and add that number,
Reply
#3

That part works.
Ill explain it better :P
If i do /kick 0 it tells me to do /kick [playerid] [reason]
But if i do /kick 0 test it gives me SERVER:Unknown Command :\

EDIT: I think I fixed it.
I had a return 1; in my KickPlayer function, when I removed that it worked!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)