-> Описание:
этот плагин блокирует спам от игроков, зависит от числа кваров, например amx_spam_max "5", игрок имеет 5 возможностей спамить, но "спам" не появляется, и если игрок проспамит 5 раз то его автоматически кикнет, Вы можите добовлять слова в spam.ini
-> Квары:
amx_spam_option "0"
amx_spam_max "5"
amx_spam_ban_time "3"
amx_spam_log "1"
-> Скачать:
spam-kick-1.4-rus-by-ju.rar [0 b] (cкачиваний: 398)
Исходник:
/******************************************************************************************
* Cvars: *
* amx_spam_option 1 // 0=only block | 1=kick | 2=ban | 3=ip *
* amx_spam_max 5 // Setup max spam count *
* //amx_spam_ban_time is only work when amx_spam_option 2 or 3 *
* amx_spam_ban_time 3 // Setup bantime 5=5minutes | 60=1hour | max 1440=1day *
* amx_spam_log 1 // Log all spam kick, ban and quits *
*******************************************************************************************/
#include
#include
// Custom Spam File, you can change this, location in configs folder
new const SK_SPAM_FILE[] = "spam.ini"
// End of Custom
// Player var
new g_spam_count[33]
// Game var
new g_array_created
// CVAR Pointers
new cvar_spam_option, cvar_spam_max, cvar_spam_ban, cvar_spam_log
// Arrays
new Array:g_spam
public plugin_precache()
{
// Create the Array
g_spam = ArrayCreate(32, 1)
// Set Array is created for reading Spam file
g_array_created = true
}
public plugin_init()
{
// Register Plugin
register_plugin("Spam Kick", "1.4", "g_often & schmurgel1983")
// Language file
register_dictionary("spam.txt")
// Hook Saying
register_clcmd("say", "SpamKick")
register_clcmd("say_team", "SpamKick")
// CVARS
cvar_spam_option = register_cvar("amx_spam_option", "1")
cvar_spam_max = register_cvar("amx_spam_max", "1")
cvar_spam_ban = register_cvar("amx_spam_ban_time", "3")
cvar_spam_log = register_cvar("amx_spam_log", "1")
}
public plugin_cfg()
{
// Load Spam File
load_spam()
}
public client_putinserver(id)
{
// Setup Player var
g_spam_count[id] = 0;
}
public SpamKick(id)
{
// Not a Admin
if(!is_user_admin(id))
{
// Read what the Player was writing
new Args[200]
read_args(Args, 199)
// Setup Ban Time
new BanTimes = get_cvar_num("amx_spam_ban_time")
if(BanTimes > 1440) set_cvar_num("amx_spam_ban_time", 1440)
if(BanTimes < 1) set_cvar_num("amx_spam_ban_time", 1)
// Get Spam Option
new option = get_pcvar_num(cvar_spam_option)
// to compare
new buffer[32]
for(new i = 0; i = get_pcvar_num(cvar_spam_max))
{
new mes_log[100], mes_action[100]
switch(option)
{
case 1: // Kick Player
{
if(get_pcvar_num(cvar_spam_log))
{
format(mes_log, charsmax(mes_log), "%L", LANG_SERVER, "SK_LOG_KICK", name, authid, g_spam_count[id], get_pcvar_num(cvar_spam_max))
log_amx("[Spam Kick] %s", mes_log)
}
format(mes_action, charsmax(mes_action), "%L", LANG_PLAYER, "SK_SERVER_KICK", g_spam_count[id], get_pcvar_num(cvar_spam_max))
server_cmd("kick #%d %s", get_user_userid(id), mes_action)
break;
}
case 2: // Ban ID Player
{
if(get_pcvar_num(cvar_spam_log))
{
format(mes_log, charsmax(mes_log), "%L", LANG_SERVER, "SK_LOG_BAN", name, authid, get_pcvar_num(cvar_spam_ban), g_spam_count[id], get_pcvar_num(cvar_spam_max))
log_amx("[Spam Kick] %s", mes_log)
}
server_cmd("banid ^"%i.0^" ^"%s^";wait;writeid", get_pcvar_num(cvar_spam_ban), authid)
format(mes_action, charsmax(mes_action), "%L", LANG_PLAYER, "SK_SERVER_BAN", get_pcvar_num(cvar_spam_ban), g_spam_count[id], get_pcvar_num(cvar_spam_max))
server_cmd("kick #%d %s", get_user_userid(id), mes_action)
break;
}
case 3: // Ban IP Player
{
if(get_pcvar_num(cvar_spam_log))
{
format(mes_log, charsmax(mes_log), "%L", LANG_SERVER, "SK_LOG_BAN", name, intpro, get_pcvar_num(cvar_spam_ban), g_spam_count[id], get_pcvar_num(cvar_spam_max))
log_amx("[Spam Kick] %s", mes_log)
}
server_cmd("addip ^"%i.0^" ^"%s^";wait;writeip", get_pcvar_num(cvar_spam_ban), intpro)
format(mes_action, charsmax(mes_action), "%L", LANG_PLAYER, "SK_SERVER_BAN", get_pcvar_num(cvar_spam_ban), g_spam_count[id], get_pcvar_num(cvar_spam_max))
server_cmd("kick #%d %s", get_user_userid(id), mes_action)
break;
}
}
}
return PLUGIN_HANDLED
}
}
}
return PLUGIN_CONTINUE
}
load_spam()
{
// Get Config Dir
new archive[32], file_spam[64]
get_configsdir(archive, 31)
formatex(file_spam, 63, "%s/%s", archive, SK_SPAM_FILE)
// File not found or array not created, stop plugin
if(!file_exists(file_spam) || !g_array_created)
{
log_amx("[Spam Kick] %s %s", file_exists(file_spam) ? "Spam file found -" : "Spam file not found -", g_array_created ? " Array created." : " Array not created.")
pause("ad")
return;
}
new linea[128], file = fopen(file_spam, "rt")
if(file)
{
while(file && !feof(file))
{
fgets(file, linea, 127)
replace(linea, 127, "^n", "")
if(linea[0] == '/' && linea[1] == '/' || linea[0] == ';' || strlen(linea) < 1)
continue;
ArrayPushString(g_spam, linea)
}
}
fclose(file)
}
* Cvars: *
* amx_spam_option 1 // 0=only block | 1=kick | 2=ban | 3=ip *
* amx_spam_max 5 // Setup max spam count *
* //amx_spam_ban_time is only work when amx_spam_option 2 or 3 *
* amx_spam_ban_time 3 // Setup bantime 5=5minutes | 60=1hour | max 1440=1day *
* amx_spam_log 1 // Log all spam kick, ban and quits *
*******************************************************************************************/
#include
#include
// Custom Spam File, you can change this, location in configs folder
new const SK_SPAM_FILE[] = "spam.ini"
// End of Custom
// Player var
new g_spam_count[33]
// Game var
new g_array_created
// CVAR Pointers
new cvar_spam_option, cvar_spam_max, cvar_spam_ban, cvar_spam_log
// Arrays
new Array:g_spam
public plugin_precache()
{
// Create the Array
g_spam = ArrayCreate(32, 1)
// Set Array is created for reading Spam file
g_array_created = true
}
public plugin_init()
{
// Register Plugin
register_plugin("Spam Kick", "1.4", "g_often & schmurgel1983")
// Language file
register_dictionary("spam.txt")
// Hook Saying
register_clcmd("say", "SpamKick")
register_clcmd("say_team", "SpamKick")
// CVARS
cvar_spam_option = register_cvar("amx_spam_option", "1")
cvar_spam_max = register_cvar("amx_spam_max", "1")
cvar_spam_ban = register_cvar("amx_spam_ban_time", "3")
cvar_spam_log = register_cvar("amx_spam_log", "1")
}
public plugin_cfg()
{
// Load Spam File
load_spam()
}
public client_putinserver(id)
{
// Setup Player var
g_spam_count[id] = 0;
}
public SpamKick(id)
{
// Not a Admin
if(!is_user_admin(id))
{
// Read what the Player was writing
new Args[200]
read_args(Args, 199)
// Setup Ban Time
new BanTimes = get_cvar_num("amx_spam_ban_time")
if(BanTimes > 1440) set_cvar_num("amx_spam_ban_time", 1440)
if(BanTimes < 1) set_cvar_num("amx_spam_ban_time", 1)
// Get Spam Option
new option = get_pcvar_num(cvar_spam_option)
// to compare
new buffer[32]
for(new i = 0; i = get_pcvar_num(cvar_spam_max))
{
new mes_log[100], mes_action[100]
switch(option)
{
case 1: // Kick Player
{
if(get_pcvar_num(cvar_spam_log))
{
format(mes_log, charsmax(mes_log), "%L", LANG_SERVER, "SK_LOG_KICK", name, authid, g_spam_count[id], get_pcvar_num(cvar_spam_max))
log_amx("[Spam Kick] %s", mes_log)
}
format(mes_action, charsmax(mes_action), "%L", LANG_PLAYER, "SK_SERVER_KICK", g_spam_count[id], get_pcvar_num(cvar_spam_max))
server_cmd("kick #%d %s", get_user_userid(id), mes_action)
break;
}
case 2: // Ban ID Player
{
if(get_pcvar_num(cvar_spam_log))
{
format(mes_log, charsmax(mes_log), "%L", LANG_SERVER, "SK_LOG_BAN", name, authid, get_pcvar_num(cvar_spam_ban), g_spam_count[id], get_pcvar_num(cvar_spam_max))
log_amx("[Spam Kick] %s", mes_log)
}
server_cmd("banid ^"%i.0^" ^"%s^";wait;writeid", get_pcvar_num(cvar_spam_ban), authid)
format(mes_action, charsmax(mes_action), "%L", LANG_PLAYER, "SK_SERVER_BAN", get_pcvar_num(cvar_spam_ban), g_spam_count[id], get_pcvar_num(cvar_spam_max))
server_cmd("kick #%d %s", get_user_userid(id), mes_action)
break;
}
case 3: // Ban IP Player
{
if(get_pcvar_num(cvar_spam_log))
{
format(mes_log, charsmax(mes_log), "%L", LANG_SERVER, "SK_LOG_BAN", name, intpro, get_pcvar_num(cvar_spam_ban), g_spam_count[id], get_pcvar_num(cvar_spam_max))
log_amx("[Spam Kick] %s", mes_log)
}
server_cmd("addip ^"%i.0^" ^"%s^";wait;writeip", get_pcvar_num(cvar_spam_ban), intpro)
format(mes_action, charsmax(mes_action), "%L", LANG_PLAYER, "SK_SERVER_BAN", get_pcvar_num(cvar_spam_ban), g_spam_count[id], get_pcvar_num(cvar_spam_max))
server_cmd("kick #%d %s", get_user_userid(id), mes_action)
break;
}
}
}
return PLUGIN_HANDLED
}
}
}
return PLUGIN_CONTINUE
}
load_spam()
{
// Get Config Dir
new archive[32], file_spam[64]
get_configsdir(archive, 31)
formatex(file_spam, 63, "%s/%s", archive, SK_SPAM_FILE)
// File not found or array not created, stop plugin
if(!file_exists(file_spam) || !g_array_created)
{
log_amx("[Spam Kick] %s %s", file_exists(file_spam) ? "Spam file found -" : "Spam file not found -", g_array_created ? " Array created." : " Array not created.")
pause("ad")
return;
}
new linea[128], file = fopen(file_spam, "rt")
if(file)
{
while(file && !feof(file))
{
fgets(file, linea, 127)
replace(linea, 127, "^n", "")
if(linea[0] == '/' && linea[1] == '/' || linea[0] == ';' || strlen(linea) < 1)
continue;
ArrayPushString(g_spam, linea)
}
}
fclose(file)
}
Понравился плагин? нажми