SA-MP Forums Archive
how do i make a custom message (instead of "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)
+--- Thread: how do i make a custom message (instead of "Unknown Command") (/showthread.php?tid=465398)



how do i make a custom message (instead of "Unknown Command") - sansk - 22.09.2013

the tittle says everything..


Re: how do i make a custom message (instead of "Unknown Command") - Patrick - 22.09.2013

What command processor are you using?


Re: how do i make a custom message (instead of "Unknown Command") - sansk - 22.09.2013

ZCMD


Re: how do i make a custom message (instead of "Unknown Command") - Patrick - 22.09.2013

Here you go, I've included some explanation inside, Enjoy!

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)//callback from #include <zcmd>
{//open
    if(!success)//If the command does not exist on the server, ! = false
        return SendClientMessage(playerid, COLOR_WHITE, "Your Error Message Here.");//showing the message
    return 1;
}//close



Re: how do i make a custom message (instead of "Unknown Command") - sansk - 22.09.2013

Thanks a lot!
and for not just giving me something to past but telling me how it works.


Re: how do i make a custom message (instead of "Unknown Command") - Konstantinos - 22.09.2013

OnPlayerCommandPerformed is called after a command execution. If the command does not exist returns 0, so..
pawn Код:
if(!success)
// if it returns 0, send an error message