19.07.2009, 10:29
You need to use strfind like this:
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
Fixes:
pawn Код:
if(strfind(text, "kanker", true) != -1)
//they said kanker somewhere
else
//they didn't
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;
}
- 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).