Custom Error MSG
#1

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?
Reply
#2

Use this instead.

PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success){
    if(!
success){
    
format(string,sizeof(string),"[Server] This command(%s) doesn't exist. Do /cmds for see all commands."cmdtext);               
    
SCM(playeridCOLORstring);}
    return 
1;

Reply
#3

Thanks, it work!
Reply
#4

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.
Reply
#5

I use izcmd !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)