Custom Error MSG - 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: Custom Error MSG (
/showthread.php?tid=594518)
Custom Error MSG -
theo546 - 19.11.2015
Hello,
I want to make a custom error message like this:
If player enter /blabla, and if this command doesn't exist,
the server will send:
[Server] This command(/blabla) doesn't exist. Do /cmds for see all commands.
I do:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/test", cmdtext, true, 10) == 0)
{
SCM(playerid, COLOR, "It's work!");
return 1;
}
new string[256];
format(string,sizeof(string),"[Server] This command(%s) doesn't exist. Do /cmds for see all commands.", cmdtext);
return SCM(playerid, COLOR, string);
}
The server send "SERVER: Unknown command."
What i need to do?
Re: Custom Error MSG -
Karan007 - 19.11.2015
Use this instead.
PHP код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success){
if(!success){
format(string,sizeof(string),"[Server] This command(%s) doesn't exist. Do /cmds for see all commands.", cmdtext);
SCM(playerid, COLOR, string);}
return 1;
}
Re: Custom Error MSG -
theo546 - 19.11.2015
Thanks, it work!
Re: Custom Error MSG -
Karan007 - 19.11.2015
Quote:
Originally Posted by theo546
Thanks, it work!
|
No problem. I would advise you not to use strcmp. But instead, use ZCMD. It's much more faster.
Re: Custom Error MSG -
theo546 - 19.11.2015
I use izcmd !