Supressing "SERVER: Unkown Command"
#1

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?
Reply
#2

Each command should return 1.
Reply
#3

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.
Reply
#4

Err... so your commands work, but they will also say "Server: Unknown Command"?
Sorry, I am confused
Reply
#5

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?
Reply
#6

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
Reply
#7

Thanks.. But I never had a command problem.

Configuring the return of "OnPlayerCommandRecieved" does nothing.. Except disabling commands if I set it to 0
Reply
#8

He means, he doesnt like "Unknown Command" he wants the text change to somthing? (what i would put; dude, you f**ked up somwhere")
Reply
#9

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.
Reply
#10

Here's the solution:

Код:
OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
	return 1;
}
You guys got close, though :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)