Detect
#2

You need to use strfind like this:

pawn Код:
if(strfind(text, "kanker", true) != -1)
//they said kanker somewhere
else
//they didn't
And for the record your SendClientMessage Sytax is wrong, and you need not format the 2nd and 3rd message. I'll tidy this up and post here.

https://sampwiki.blast.hk/wiki/Scripting...ns_Old#strfind

pawn Код:
#include <a_samp>

new
    playername[MAX_PLAYER_NAME],
    string[128];
   
#define COLOR_RED 0xFF0000AA

public OnPlayerText(playerid, text[])
{
    if(strfind(text, "kanker", true) != -1)
    {
        GetPlayerName(playerid, playername, sizeof(playername));
        format(string, sizeof(string), "=>|[Anti-Flame]|<= Banned: %s for Flaming with a disease", playername);
        SendClientMessageToAll(COLOR_RED, string);
        SendClientMessage(playerid, COLOR_RED, "=>|[Anti-Flame]|<= You Got Banned For 2 Days");
        SendClientMessage(playerid, COLOR_RED, "=>|[Anti-Flame]|<= Make a unban appeal on the forum");
        Ban(playerid);
        return 0;
    }
    return 1;
}
Fixes:
  • I took out the unnecessary formats
  • Used fewer cells in your string
  • Took out the IsPlayerConnected check (non-connected players don't usually say stuff)
  • Put the strfind in
  • Moved your array declarations outside the command (so they don't have to be declared everytime someone is stupid enough to say kanker).
Reply


Messages In This Thread
Detect - by radi - 19.07.2009, 10:26
Re: Detect - by Weirdosport - 19.07.2009, 10:29
Re: Detect - by radi - 19.07.2009, 11:12
Re: Detect - by Weirdosport - 19.07.2009, 11:14
Re: Detect - by radi - 19.07.2009, 11:44
Re: Detect - by Pawno_Master - 19.07.2009, 11:57

Forum Jump:


Users browsing this thread: 5 Guest(s)