SERVER: Unknown Command
#1

How would i get rid of SERVER: Unknown Command.

when i use a command that is unknown to the server
Reply
#2

' return 0; ' could be a solution.. Maybe show the cmd?
Reply
#3

I have this in my GM and it works, if it help...

Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
	if(!success) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Upisali ste komandu koja ne postoji!");
	return true;
}
Reply
#4

Do you have "OnPlayerCommandText" in your code? If so remove it.

EDIT: My bad i thought you was using zcmd because of the above post
Reply
#5

on the end of onplayercommand change


Код:
return 0;
to

Код:
return SendClientMessage(playerid,0xFFFFFFFF,"WRONG COMMAND Newb ;P");
Reply
#6

Quote:
Originally Posted by System64
Посмотреть сообщение
I have this in my GM and it works, if it help...

Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
	if(!success) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Upisali ste komandu koja ne postoji!");
	return true;
}
Why don't you just put ' SendClientMessage(playerid,COLOR_LIGHTBLUE,"Upisal i ste komandu koja ne postoji!"); '
at every cmd if it has been activated..
Reply
#7

Quote:
Originally Posted by [SFA]SpiRRiT
Посмотреть сообщение
Why don't you just put ' SendClientMessage(playerid,COLOR_LIGHTBLUE,"Upisal i ste komandu koja ne postoji!"); '
at every cmd if it has been activated..
Because that spams, and it can be done much easyer.
Reply
#8

Quote:
Originally Posted by alpha500delta
Посмотреть сообщение
Because that spams, and it can be done much easyer.
It wasn't a question for you.. But okey,
Reply
#9

If you are using the simple command system, Try to edit/remove this line:

This:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}
To:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
        else SendClientMessage(playerid, 0xFFFFFFFF, "LAWL, Invalid Command.");
	return 1;
}
Reply
#10

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
return SendClientMessage(playerid,0xFFFF00FF,"Your message (instead of the "Unknown Command")");
}
Reply
#11

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    //Every command here
    return SendClientMessage(playerid, 0xAFAFAFAA, "Custom unknown command text");
}
That works. But then you must add 'return 1;' after ALL the commands!
pawn Код:
if(!strcmp(cmdtext, "/my_command"))
{
    //Do something
    return 1; //<--
}
Why?
After performing the command, it'll return '1' (or 'true'). If you have the following commands:
/my_command
/help
and if they both have, it will return the value '1'. If you don't perform one of those commands, it won't return the value '1', so it will automatic call the return at the end of onPlayerCommandText. You can compare it with this:
pawn Код:
switch(random(10))
{
    case 0,1,2,3: print("0, 1, 2 or 3 was the random"); //if it is 0, 1, 2 or 3
    default: print("The random was something else"); //if it's something else
}
If you compare it with OnPlayerCommandText, the 'case 0,1,2,3' are the commands, the 'default' is the "unknown command". I hope that that was clear enough
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)