SA-MP Forums Archive
changing server unknown command help - 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: changing server unknown command help (/showthread.php?tid=186712)



changing server unknown command help - hadzx - 30.10.2010

ok i wana change it because when i type a invaild command nothing comes up nd ppl gettin confused and i changed it and when i type a vaild command the command works but it also says invaild command how do i make it so vaild commands dont say invaild command

thx


Re: changing server unknown command help - JaTochNietDan - 30.10.2010

If it says invalid command after you type a valid command, it means that you haven't added a return 1; to complete the command. For example:

pawn Код:
public OnPlayerCommandText(playerid,cmdtext[]);
{
    if(strcmp(cmdtext,"/rofl",true) == 0)
    {
        //Stuff in your command...
        return 1; // We add this at the very end of the command, this stops further execution of code in the callback OnPlayerCommandText
    }
    return SendClientMessage(playerid,red,"Command is not correct!");
}
Hope that helps

Additional note: Returning 0 in OnPlayerCommandText will tell the client that the command is wrong and automatically send a message saying Invalid Command!