Detecting where a string is using strfind?
#1

pawn Code:
public OnPlayerText(playerid, text[])
{
    if( strfind( text, "~r~", true ) != -1 )
    {
        new
            cStr [ 128 ],
            plName [ MAX_PLAYER_NAME ];
           
        GetPlayerName( playerid, plName, MAX_PLAYER_NAME );
           
        strdel( text, 0, 3 );
        format( cStr, 128, ""#I_White"%s says: "#I_ARed"%s", plName, text );
        SendClientMessageToAll( -1, cStr );
        return false;
    }
    return true;
}
I've got that - and it works fine, but if I put "hi ~r~" it will still turn the text red, and delete the message, rather than the red tag. Basically, how do I check if "~r~" is the first 3 characters of the message?
Reply


Messages In This Thread
Detecting where a string is using strfind? - by 2KY - 18.11.2012, 14:04
Re: Detecting where a string is using strfind? - by Faisal_khan - 18.11.2012, 14:15
Re: Detecting where a string is using strfind? - by 2KY - 18.11.2012, 14:17
Re: Detecting where a string is using strfind? - by [KHK]Khalid - 18.11.2012, 14:20
Re: Detecting where a string is using strfind? - by Faisal_khan - 18.11.2012, 14:23
Re: Detecting where a string is using strfind? - by 2KY - 18.11.2012, 14:23
Re: Detecting where a string is using strfind? - by Vince - 18.11.2012, 14:24
Re: Detecting where a string is using strfind? - by [KHK]Khalid - 18.11.2012, 14:24

Forum Jump:


Users browsing this thread: 1 Guest(s)