SA-MP Forums Archive
Error message - 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: Error message (/showthread.php?tid=496263)



Error message - venomlivno8 - 21.02.2014

How to set " ERROR: Unknown command!" when the player enters the wrong command to " That command doesn't exist! Use /help to see available commands!"


Re: Error message - Abagail - 21.02.2014

Use OnPlayerCommandPerformed and do:

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) SendClientMessage(playerid, -1, "SERVER: You have entered an unknown command! Use /help to see avaliable commands!");
return 1;
}

It will also send this message if the command returns 0 which can be used to trick them into thinking the command they entered doesn't exist. Anyway, there you go. If I helped you it wouldn't hurt to REP me. If you don't want to REP me, at-least say thanks!

- Abagail


Re: Error message - Konstantinos - 21.02.2014

For ZCMD:
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if (!success) return SendClientMessage(playerid, -1, " That command doesn't exist! Use /help to see available commands!");
    return 1;
}
For strcmp:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    // commands..

    return SendClientMessage(playerid, -1, " That command doesn't exist! Use /help to see available commands!");
}