SA-MP Forums Archive
Detect - 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: Detect (/showthread.php?tid=87260)



Detect - radi - 19.07.2009

how can i make from this pawn code
this is the pawn code that if a player says kanker it wil be banned
like this Radi:kanker
but i want to make it that it wil also ban if the word kanker is some where else like
Radi: You are kanker


[pawn]
if(strcmp(text, "kanker", true) == 0)
{
new playername[MAX_PLAYER_NAME];
new string[256];
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "=>|[Anti-Flame]|<= Banned: %s for Flaming with a disease ", playername);
SendClientMessageToAll(COLOR_RED, string);
format(string, sizeof(string), "=>|[Anti-Flame]|<= You Got Banned For 2 Days ");
SendClientMessage(COLOR_RED, string);
format(string, sizeof(string), "=>|[Anti-Flame]|<= Make a unban appeal on the forum ");
SendClientMessage(COLOR_RED, string);
Ban(playerid);
}
return 0;
}
[/pawn


Re: Detect - Weirdosport - 19.07.2009

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:



Re: Detect - radi - 19.07.2009

how it works like that
can put it in the way it supose to be in my thing because i dont know how it works



Re: Detect - Weirdosport - 19.07.2009

I can't put it in your script without actually seeing your script. Do you have the OnPlayerText callback?


Re: Detect - radi - 19.07.2009

THANK YOU
it works


Re: Detect - Pawno_Master - 19.07.2009

isnt it a little hard to ban a player is he sayas kanker

maybe you can warn him
or something