SERVER: Unknown Command -
Artix - 04.05.2011
How would i get rid of SERVER: Unknown Command.
when i use a command that is unknown to the server
Re: SERVER: Unknown Command -
[SFA]SpiRRiT - 04.05.2011
' return 0; ' could be a solution.. Maybe show the cmd?
Re: SERVER: Unknown Command -
System64 - 04.05.2011
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;
}
Re: SERVER: Unknown Command -
iggy1 - 04.05.2011
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
Re: SERVER: Unknown Command -
CrazyBlob - 04.05.2011
on the end of onplayercommand change
to
Код:
return SendClientMessage(playerid,0xFFFFFFFF,"WRONG COMMAND Newb ;P");
Re: SERVER: Unknown Command -
[SFA]SpiRRiT - 04.05.2011
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..
Re: SERVER: Unknown Command -
alpha500delta - 04.05.2011
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.
Re: SERVER: Unknown Command -
[SFA]SpiRRiT - 04.05.2011
Quote:
Originally Posted by alpha500delta
Because that spams, and it can be done much easyer.
|
It wasn't a question for you.. But okey,
Re: SERVER: Unknown Command -
iPLEOMAX - 04.05.2011
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;
}
Re: SERVER: Unknown Command -
nuriel8833 - 04.05.2011
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
return SendClientMessage(playerid,0xFFFF00FF,"Your message (instead of the "Unknown Command")");
}
Re: SERVER: Unknown Command -
Kwarde - 05.05.2011
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