SA-MP Forums Archive
OnPlayerCommandText RETURN MESSAGE [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: OnPlayerCommandText RETURN MESSAGE [HELP] (/showthread.php?tid=174090)



OnPlayerCommandText RETURN MESSAGE [SOLVED] - park4bmx - 04.09.2010

THANKS ALL FOR HELPING PROBLEM IS NOW SOLVED


Re: OnPlayerCommandText RETURN MESSAGE [HELP] - iggy1 - 04.09.2010

That is done automaticaly if the command doesn't exist.


Re: OnPlayerCommandText RETURN MESSAGE [HELP] - Virtual1ty - 04.09.2010

If you want custom error messages when the command doesn't exist use this example:

Instead of returning 0 at OnplayerCommandText, use SendClientMessage and your own custom message.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/test", true))
    {
        // Do something here
        return true;
    }
    return SendClientMessage(playerid, 0xFFFFFF, "CUSTOM: Unknown COMMAND");
}



Re: OnPlayerCommandText RETURN MESSAGE [HELP] - park4bmx - 04.09.2010

i KNOW
But it only sas
SERVER:UNKNOWN COMMAND
I want it to be displayed by GameTextForPlayer and to display what ever they typed wrong


Re: OnPlayerCommandText RETURN MESSAGE [HELP] - Virtual1ty - 04.09.2010

Then use format with GameTextForPlayer instead of SendClientMessage, also be carefull with those extra parameters.

EDIT: fast example:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new
        string[128];
       
    if(!strcmp(cmdtext, "/test", true))
    {
        // Do something here
        return true;
    }
    format(string, sizeof(string), "%s", cmdtext);
    return GameTextForPlayer(playerid, string, xxx, x);
}



Re: OnPlayerCommandText RETURN MESSAGE [HELP] - LarzI - 04.09.2010

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/test", true))
    {
        // Do something here
        return true;
    }
    new str[ 128 ];
    format( str, sizeof( str ), "~w~Unknown command: ~r~\"%s\"", cmdtext[ 0 ] );
    return GameTextForPlayer( playerid, str, 5000, 6 );
}



Re: OnPlayerCommandText RETURN MESSAGE [HELP] - Zh3r0 - 04.09.2010

Here it is.

pawn Код:
new str[ 50 ];
format( str,sizeof( str ), "~w~ %s is an ~r~UNKNOWN COMMAND!",cmdtext );
GameTextForPlayer( playerid, str, 3000,3 );
OMG larzI, we made it identical! xD Almost..


Re: OnPlayerCommandText RETURN MESSAGE [HELP] - Virtual1ty - 04.09.2010

Offtopic: LOL, we all made it indentical,,

well the problem is solved, topic can be locked, or something


Re: OnPlayerCommandText RETURN MESSAGE [HELP] - park4bmx - 04.09.2010

Thans to all for HELPING
But MOST THANKS TO LarzI & Zh3r0 Because That's what i was looking for


Re: OnPlayerCommandText RETURN MESSAGE [HELP] - LarzI - 04.09.2010

No problem ^^
BTW: Virtual1ty made the same thing, he just didn't fill out all the parameters ^^