#include <amxmodx>
//#include <amxmisc>
#include <colorchat>
#define PLUGIN "Restrict Advertising"
#define VERSION "1.0"
#define AUTHOR "Alka & Sn!ff3r"
stock const advertising_words[][] = {
"www.",
".pl",
"pl",
".com",
".net",
".org",
".no-ip",
"xaa",
"ArenaSkilla",
".ru"
}
stock const cheats_words[][] = {
"wh",
"wallhack",
"aim",
"aimbot",
"sh",
"speedhack",
"cheaty",
"odpalon",
"hack"
}
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("say", "hook_chat");
register_clcmd("say_team", "hook_chat");
register_cvar("amx_adspunish_mode","2")
register_cvar("amx_adsban_time","5")
}
public hook_chat(id)
{
new szArgs[512];
read_args(szArgs, 511);
new len;
len = strlen(szArgs);
new digits, periods;
new userid = get_user_userid(id)
new szName[32];
get_user_name(id, szName, 31);
new bool:znalazl
for(new i = 0 ; i < sizeof (cheats_words) ; i++)
{
if(containi(szArgs, cheats_words[i]) != -1)
{
ColorChat(id, GREEN, "^x01 # Cheaterow prosimy zglaszac na^x03 say^x01_^x03team^x01 ->^x03 @nick rodzaj^x01_^x03wspomagacza")
znalazl = true;
}
}
for(new i = 0 ; i < sizeof (advertising_words) ; i++)
{
if(containi(szArgs, advertising_words[i]) != -1)
{
new punish = get_cvar_num("amx_adspunish_mode")
if(punish == 1)
server_cmd("amx_ban %d #%d ^"Reklama!^"", get_cvar_num("amx_adsban_time"), userid);
else if(punish ==2)
client_cmd(id, "say ^" - Siec serwerow Twoich marzen!^"");
return 1;
}
}
//pobrano z cs-puchatek.pl
for(new i; i < len; i++)
{
if(isdigit(szArgs[i]))
{
digits++
}
else if(szArgs[i] == '.' || szArgs[i] == '*' || szArgs[i] == '#' || szArgs[i] == '^^' || szArgs[i] == ',' || szArgs[i] == ':')
{
periods++
}
}
if(digits > 3 && periods > 2)
{
new punish = get_cvar_num("amx_adspunish_mode")
if(punish == 1)
{
server_cmd("amx_ban %d #%d ^"Reklama!^"", get_cvar_num("amx_adsban_time"), userid);
}
else if(punish ==2)
client_cmd(id, "say ^" - Siec serwerow Twoich marzen!^"");
return 1;
}
if(znalazl)
return PLUGIN_HANDLED;
return PLUGIN_CONTINUE;
}