21/06/2017, 04:07 PM
Alguien que me de una mano con este antispam la verdad que me gusta mucho pero quiero que igual sea por nombre ejemplo si se ponen 5 numeros en sus nombre no les deje cambiar, saludos.
Código PHP:
#include <amxmodx>
#define PLUGIN "Anti-Spam"
#define VERSION "1.3"
#define AUTHOR "ReymonARG"
#define SVTAG "[anti-spam]:"
enum
{
NUM = 0,
POINT = 1,
TOTAL
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say_team", "hook_say")
register_clcmd("say", "hook_say")
}
public hook_say(id)
{
new args[192], contador[TOTAL]
read_args(args, 191)
replace_all(args, 191, " ", "")
for( new i = 0; i < strlen(args) ; i++)
{
if(48 <= args[i] <= 57)//del 48 a 57 son los numeros en ascii
{
contador[NUM]++
args[i] = 'x'
}
if(args[i] == 46)//el 46 es el punto
{
contador[POINT]++
}
}
if(contador[POINT] >= 2 || containi(args, "www") != -1)
{
ChatColor(id, "!g%s !yNo puedes hacer spam.", SVTAG)
return PLUGIN_HANDLED;
}
else if(contador[NUM] >= 4)
{
if( contador[POINT] )
{
ChatColor(id, "!g%s !yNo puedes hacer SPAM . !tPor favor", SVTAG)
return PLUGIN_HANDLED
}
else
{
ChatColor(id, "!g%s !yNo puedes hacer SPAM . !t-.-", SVTAG)
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
stock ChatColor(id, const text[], any:...)
{
new g_iMsgidSayText;
g_iMsgidSayText = get_user_msgid("SayText");
new szMsg[191], iPlayers[32], iCount = 1;
vformat(szMsg, charsmax(szMsg), text, 3);
replace_all(szMsg, charsmax(szMsg), "!g","^x04");
replace_all(szMsg, charsmax(szMsg), "!y","^x01");
replace_all(szMsg, charsmax(szMsg), "!t","^x03");
if(id)
iPlayers[0] = id;
else
get_players(iPlayers, iCount, "ch");
for(new i = 0 ; i < iCount ; i++)
{
if(!is_user_connected(iPlayers[i]))
continue;
message_begin(MSG_ONE_UNRELIABLE, g_iMsgidSayText, _, iPlayers[i]);
write_byte(iPlayers[i]);
write_string(szMsg);
message_end();
}
}