SA-MP Forums Archive
How to customize "SERVER:Unknown Command"? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to customize "SERVER:Unknown Command"? (/showthread.php?tid=249400)



How to customize "SERVER:Unknown Command"? - Bates - 18.04.2011

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!


Re: How to customize "SERVER:Unknown Command"? - Sascha - 18.04.2011

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...


Re: How to customize "SERVER:Unknown Command"? - Bates - 18.04.2011

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


Re: How to customize "SERVER:Unknown Command"? - Sascha - 18.04.2011

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



Re: How to customize "SERVER:Unknown Command"? - Joe Staff - 18.04.2011

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(...)"


Re: How to customize "SERVER:Unknown Command"? - Mean - 18.04.2011

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.


Re: How to customize "SERVER:Unknown Command"? - Bates - 18.04.2011

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.


Re: How to customize "SERVER:Unknown Command"? - MP2 - 18.04.2011

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


Re: How to customize "SERVER:Unknown Command"? - Bates - 18.04.2011

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;
}



Re: How to customize "SERVER:Unknown Command"? - Mean - 19.04.2011

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!