https://prnt.sc/rv87lf
I found one : im not user if it okey
Код за потвърждение: Избери целия код
#include <amxmodx>
#include <amxmisc>
#include <regex>
// Preprocessor macros (Config)
#define PLAYER_NEWNAME "Player"
#define IN_GAME_WARNING_MSG "Warning! Do not advertise sites or other servers"
#define NICK_CHANGED_INFO "Nick has been changed! Do not push back the name of the site or server"
#define MSG_BLOCK_INFO "Advertising on your behalf, please do not advertise other sites/servers"
new g_newname_num = 1
public plugin_init()
{
register_plugin("Anti-Spam Lite", "1.0.4", "NullWarez")
register_clcmd("say","check_player_msg")
register_clcmd("say_team","check_player_msg")
}
// Check the nick when connecting
public client_putinserver(id)
{
if(is_user_admin(id))
return PLUGIN_CONTINUE
new g_name[32]
get_user_name(id, g_name,31)
if(is_invalid(g_name))
{
server_cmd("amx_nick #%d ^"PLAYER_NEWNAME-%d^"", get_user_userid(id), g_newname_num);
g_newname_num++
set_hudmessage (200, 0, 0, -1.0, 0.35, 1, 0.0, 5.0, 1.0, 1.0, 1)
show_hudmessage(id, "NICK_CHANGED_INFO");
}
set_task(20.0, "showWarning", id)
return PLUGIN_CONTINUE
}
// Checks the message for spam
bool:is_invalid(const text[])
{
new error[50], num
new Regex:regex = regex_match (text, "[a-z0-9-]{3,}\.[a-z]{1,2}(\S)", num, error, 49, "i")
if(regex >= REGEX_OK)
{
regex_free(regex)
return true
}
regex = regex_match(text, "([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}", num, error, 49)
if(regex >= REGEX_OK)
{
regex_free(regex)
return true
}
return false
}
// Displays a warning ban for spam
public showWarning(id)
{
if(is_user_connected(id))
client_print(id, print_chat, "IN_GAME_WARNING_MSG")
}
// Check say or say_team message
public check_player_msg(id)
{
if(is_user_admin(id))
return PLUGIN_CONTINUE
new text[128]
read_args(text,127)
if(is_invalid(text))
{
client_print(id, print_chat, "MSG_BLOCK_INFO")
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
// Called when set name
public client_infochanged(id)
{
if(is_user_admin(id))
return PLUGIN_CONTINUE
if(!is_user_alive(id)) // loop fix
return PLUGIN_CONTINUE
new g_name[32]
get_user_name(id, g_name,31)
if(is_invalid(g_name))
{
server_cmd("amx_nick #%d ^"PLAYER_NEWNAME-%d^"", get_user_userid(id), g_newname_num);
g_newname_num++
set_hudmessage (200, 0, 0, -1.0, 0.35, 1, 0.0, 5.0, 1.0, 1.0, 1)
show_hudmessage(id, "NICK_CHANGED_INFO");
}
return PLUGIN_CONTINUE
}