How to customize "SERVER:Unknown Command"?
#1

Hi!

How to customize the standard "SERVER: Unknown command" message? I've searched for solutions, but the only one i found was when the script used OnPlayerCommandText. My script doesnt. I don't know what it's named, but each command starts with

pawn Код:
command(cmdname, playerid, params[])
Thanks in advance!
Reply
#2

you will still be able to use it with OnPlayerCommandText:P...
just replace the "return 0;" with "return SendClientMessage(.......);"...
if that won't work, then try to put that onto the end of each "command................."
(get sure that you have a "return 1;" somewhere else within the command, so that it doesn't send it always when you use the cmd...
Reply
#3

Thing is, i searched within the gamemode and i couldn't find any OnPlayerCommandText.
Reply
#4

then just add this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    return SendClientMessage(playerid, 0x999999AA, "Message");
}
Reply
#5

He's clearly using zCMD which has the OnPlayerCommandText callback within the include, open the zcmd.inc located in pawno->includes and change any "return 0" into "return SendClientMessage(...)"
Reply
#6

If you use ZCMD, don't use OnPlayerCommandText. Add this anywhere:
pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if( success == 0 )
        return SendClientMessage( playerid, COLOR, "Your new unknown command text" );
}
@SilentHuntR: I don't recommend changing INCs.
Reply
#7

Quote:
Originally Posted by Mean
Посмотреть сообщение
If you use ZCMD, don't use OnPlayerCommandText. Add this anywhere:
pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if( success == 0 )
        return SendClientMessage( playerid, COLOR, "Your new unknown command text" );
}
@SilentHuntR: I don't recommend changing INCs.
Doesn't work, unfortunately. When i do like you wrote, i get SERVER: Unknown Command below every output, and i get warning 12. When i do

pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if( success == 0 )
    {
       
     }
     return SendClientMessage( playerid, COLOR, "Your new unknown command text" );
}
I get the custom unknown command instead of every output.
Reply
#8

You need to return 0 to stop the commands carrying over onto other scripts. Just put the client message above return 0;
Reply
#9

return 0; after every command, or like this

pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if( success == 0 )
    {
       
     }
     return SendClientMessage( playerid, COLOR, "Your new unknown command text" );
     return 0;
}
Reply
#10

Quote:
Originally Posted by Bates
Посмотреть сообщение
return 0; after every command, or like this

pawn Код:
public OnPlayerCommandPerformed( playerid, cmdtext[ ], success )
{
    if( success == 0 )
    {
       
     }
     return SendClientMessage( playerid, COLOR, "Your new unknown command text" );
     return 0;
}
This is a terrible example, it will also give a warning/error, you can't return twice!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)