Supressing "SERVER: Unkown Command" -
Deji - 03.05.2010
For some reason, removing the return or changing it to 0 does jack all.
This is an ugly message and I want rid of it. There's not really much point in saying what hasn't worked. Just say what has
Any way to get rid of it?
Re: Supressing "SERVER: Unkown Command" -
Las Venturas CNR - 03.05.2010
Each command should return 1.
Re: Supressing "SERVER: Unkown Command" -
Deji - 04.05.2010
I already know that... But that doesn't supress "Unknown Command" from showing up when a player types an unknown command. I want rid of it completely like I have seen done on some servers.
Re: Supressing "SERVER: Unkown Command" -
Las Venturas CNR - 04.05.2010
Err... so your commands work, but they will also say "Server: Unknown Command"?
Sorry, I am confused
Re: Supressing "SERVER: Unkown Command" -
Deji - 04.05.2010
Assuming you mean OnPlayerCommandText, it already returns 1 and still gives an "Unknown Command" message.
I'm not using dcmd commands like this:
Код:
dcmd(register, 8, cmdtext);
They don't seem to work for me.
Mine are like this:
Код:
command(kill, playerid, params[])
{
if (sscanf(params, "d", victim))
{
SendClientMessage(playerid, COLOR_USAGE, "Usage: \"/kill [id]\"");
}
return 1;
}
The less common dcmd, I believe. I assume it's just as good?
Re: Supressing "SERVER: Unkown Command" -
Whitetiger - 04.05.2010
pawn Код:
CMD:kill(playerid, params[])
{
sscanf(params, "s", victim)
if(!IsNumeric(victim)) return SendClientMessage(playerid, COLOR_USAGE, "Usage: "/kill [id]\"");
if(!strlen(victim)) return SendClientMessage(playerid, COLOR_USAGE, "Usage: \"/kill [id]\"");
new tmp = strval(victim);
SetPlayerHealth(tmp, 0);
new str[50], playername[MAX_PLAYER_NAME];
GetPlayerName(tmp, playername, sizeof(playername));
format(str, sizeof(str), "You killed %s!", playername);
SendClientMessage(playerid, COLOR_USAGE, str);
return 1;
}
try that
EDIT:
also if using ZCMD witch i assume you are, OnPlayerCommandText is Disabled, use OnPlayerCommandReceived(playerid, cmdtext[]), when using zcmd. <--- click for ZCMD topic
Re: Supressing "SERVER: Unkown Command" -
Deji - 04.05.2010
Thanks.. But I never had a command problem.
Configuring the return of "OnPlayerCommandRecieved" does nothing.. Except disabling commands if I set it to 0
Re: Supressing "SERVER: Unkown Command" -
-Rebel Son- - 04.05.2010
He means, he doesnt like "Unknown Command" he wants the text change to somthing? (what i would put; dude, you f**ked up somwhere")
Re: Supressing "SERVER: Unkown Command" -
Extremo - 04.05.2010
Make sure your zcmd returns 1 even if the function is not found. If it doesn't, then you are most likely to get an error, "Unknown Command". Check up the include of yours where ZCMD is defined. Also make sure that your "OnPlayerCommandText" in your zcmd include returns 1. If it doesn't, you are most likely to get a error. It doesnt matter what your "OnPlayerCommandText" returns in your script, as its not the actual OnPlayerCommandText that the zcmd uses. Unless zcmd returns your "OnPlayerCommandText", you need to change zcmd's.
Re: Supressing "SERVER: Unkown Command" -
Deji - 04.05.2010
Here's the solution:
Код:
OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
return 1;
}
You guys got close, though :P