#pragma tabsize 4
#include <a_samp>
#define RED 0xAA3333AA
#define GREEN 0x33AA33AA
new var0[25];
new var1[256];
#define MAX_SWEARS 100
#define STR 100
forward UnMute(playerid);
new Swears[MAX_SWEARS][STR];
new num_words = 0;
new swear[MAX_PLAYERS];
public OnFilterScriptInit()
{
new string[STR], File:file;
if((file = fopen("antiswear.cfg",io_read)))
{
while(fread(file,string))
{
for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
Swears[num_words] = string;
printf("%s", string);
num_words++;
}
fclose(file);
}
return 1;
}
public OnPlayerText(playerid,text[])
{
if(swear[playerid] == 1)
{
SendClientMessage(playerid, 0xFFFFFFAA, "Âû áûëè çàòêíóòû íà 60 ñåêóíä çà ìàò.");
return 0;
}
for(new s = 0; s < num_words; s++)
{
new pos;
while((pos = strfind(text,Swears[s],true)) != -1) for(new i = pos, j = pos + strlen(Swears[s]); i < j; i++){
text[i] = '*';
swear[playerid] = 1;
GetPlayerName(playerid, var0, 25);
format(var1, 256, "Èãðîêó %s àâòîìàòè÷åñêè çàáàíåí ÷àò íà 1 ìèíóòó ïî ïðè÷èíå: Ìàò(û).", var0);
SendClientMessageToAll(RED, var1);
if(swear[i] == 1)
{
SetTimerEx("UnMute",60000,0,"M",playerid);
return 0;
}
}
}
return 1;
}
public UnMute(playerid)
{
swear[playerid] = 0;
GetPlayerName(playerid, var0, 25);
format(var1, 256, "Èãðîêó %s áûë àâòîìàòè÷åñêè ðàçáàíåí ÷àò.", var0);
SendClientMessageToAll(GREEN, var1);
return 0;
}
public OnPlayerConnect(playerid)
{
swear[playerid] = 0;
return 1;
}
public OnPlayerText(playerid,text[])
{
if(swear[playerid] == 1)
{
SendClientMessage(playerid, 0xFFFFFFAA, "Âû áûëè çàòêíóòû íà 60 ñåêóíä çà ìàò.");
return 0;
}
for(new s = 0; s < num_words; s++)
{
new pos;
while((pos = strfind(text,Swears[s],true)) != -1) for(new i = pos, j = pos + strlen(Swears[s]); i < j; i++){
text[i] = '*';
swear[playerid] = 1;
GetPlayerName(playerid, var0, 25);
format(var1, 256, "Сообщение................", var0);
SendClientMessageToAll(RED, var1);
if(swear[i] == 1)
{
SetTimerEx("UnMute",60000,0,"M",playerid);
return 0;
}
}
}
return 1;
}
pawn Code:
|
for(new s = 0; s < num_words; s++)
{
new pos;
while((pos = strfind(text,Swears[s],true)) != -1)
{
for(new i = pos, j = pos + strlen(Swears[s]); i < j; i++)
{
text[i] = '*';
swear[playerid] = 1;
}
}
}
if(swear[playerid] == 1)
{
GetPlayerName(playerid, var0, 25);
format(var1, 256, "Ea?ieo %s aaoiiaoe?anee caaaiai ?ao ia 1 ieiooo ii i?e?eia: Iao(u).", var0);
SendClientMessageToAll(RED, var1);
SetTimerEx("UnMute",60000,0,"M",playerid);
return 0;
}