Antispam por nombre
#1
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(PLUGINVERSIONAUTHOR
    
register_clcmd("say_team""hook_say")  
    
register_clcmd("say""hook_say")  
}  

public 
hook_say(id)  
{  
    new 
args[192], contador[TOTAL]  
    
    
read_args(args191)  
    
    
replace_all(args191" """)  
    
    for( new 
0strlen(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] >= || 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(szMsgcharsmax(szMsg), text3); 
    
    
replace_all(szMsgcharsmax(szMsg), "!g","^x04"); 
    
replace_all(szMsgcharsmax(szMsg), "!y","^x01"); 
    
replace_all(szMsgcharsmax(szMsg), "!t","^x03"); 
    
    if(
id
        
iPlayers[0] = id
    else 
    
get_players(iPlayersiCount"ch"); 
    
    for(new 
iCount i++) 
    { 
        if(!
is_user_connected(iPlayers[i])) 
            continue; 
        
        
message_begin(MSG_ONE_UNRELIABLEg_iMsgidSayText_iPlayers[i]); 
        
write_byte(iPlayers[i]); 
        
write_string(szMsg); 
        
message_end(); 
    }

Responder
#2
https://forums.alliedmods.net/showthread.php?t=108952
Responder
#3
Lo adapte, funciona bien pero no me gusta ya que quiero que no se puedan poner "," ,"." o mas de 5 numeros alguna solucion ?
dejo el codigo

Código PHP:
#include <amxmodx> 
#include <regex>

#define PLUGIN "Anti-Spam" 
#define VERSION "1.3" 
#define AUTHOR "ReymonARG" 

#define SVTAG "[anti-spam]:"

#define PATTERN                "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" // \b

enum  
{  
    
NUM 0,  
    
POINT 1,
    
TOTAL  
}  

public 
plugin_init()  
{      
    
register_plugin(PLUGINVERSIONAUTHOR
    
register_clcmd("say_team""hook_say")  
    
register_clcmd("say""hook_say")
    
register_message(get_user_msgid("SayText"), "MessageNameChange"
}
public 
client_putinserver(idclient_infochanged(id
public 
client_infochanged(id)
{
    new 
oldname[32], newname[32]
    
get_user_name(idoldname31)
    
get_user_info(id"name"newname31)
    
    if( !
equal(oldnamenewname) )
        
check_user_name(idnewname)

public 
hook_say(id)  
{  
    new 
args[192], contador[TOTAL]  
    
    
read_args(args191)  
    
    
replace_all(args191" """)  
    
    for( new 
0strlen(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] >= || 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 
}

public 
MessageNameChange(msgiddestid)
{
    new 
szInfo[64

    
get_msg_arg_string(2szInfo63

    if(!
equali(szInfo"#Cstrike_Name_Change"))
    {
        return 
PLUGIN_CONTINUE    
    
}
    
    return 
PLUGIN_HANDLED
}  
stock check_user_name(id, const name[32] = ""
{
    new 
plrname[32]
    
    if(
equal(name""))
    {
        
get_user_name(idplrname31)
    }
    else
    {
        
plrname name
    
}
    
    new 
g_returnvalueg_error[64]
    new 
Regex:g_result regex_match(plrnamePATTERNg_returnvalueg_error63)
    switch(
g_result)
    {
        case 
REGEX_MATCH_FAILREGEX_PATTERN_FAIL:
        {
            return 
log_amx("REGEX ERROR! %s"g_error)
        }
        
        case 
REGEX_NO_MATCH:
        {
            return 
0
        
}
        
        default:
        {
            new 
name[33]
            
get_user_name(idname32)
            
client_cmd(id"name ^"Intento Spammear^"")
            
client_print(0print_chat"[Antispam] %s Fue kickeado por ponerse una ip en el nombre"name)
            
server_cmd("kick %s"name)
        
            return 
1
        
}
    }
    
    return -
1

}
stock ChatColor(id, const text[], any:...) 

    new 
g_iMsgidSayText
    
g_iMsgidSayText get_user_msgid("SayText"); 
    
    new 
szMsg[191], iPlayers[32], iCount 1
    
vformat(szMsgcharsmax(szMsg), text3); 
    
    
replace_all(szMsgcharsmax(szMsg), "!g","^x04"); 
    
replace_all(szMsgcharsmax(szMsg), "!y","^x01"); 
    
replace_all(szMsgcharsmax(szMsg), "!t","^x03"); 
    
    if(
id
        
iPlayers[0] = id
    else 
    
get_players(iPlayersiCount"ch"); 
    
    for(new 
iCount i++) 
    { 
        if(!
is_user_connected(iPlayers[i])) 
            continue; 
        
        
message_begin(MSG_ONE_UNRELIABLEg_iMsgidSayText_iPlayers[i]); 
        
write_byte(iPlayers[i]); 
        
write_string(szMsg); 
        
message_end(); 
    }

Responder
#4
Usa el que tenes por chat y aparte usa este: https://forums.alliedmods.net/showpost.p...ostcount=5

Responder
#5
y si lo adapto anda igual ? es que me da flojera tener dos plugin
Responder
#6
Hacer un loop y cada vez que encuentres un número, sumas una variable... y si llega a tu límite... kick (?, Si todavía necesitas ayuda, avisa.

[Imagen: 76561198099584158.png]
Java, Mysql, PHP, Python and more.
Responder
#7
(21/06/2017, 11:23 PM)Jaimit0 escribió: y si lo adapto anda igual ? es que me da flojera tener dos plugin

Adaptalo, funcionará igual, solo si lo haces bien v:

Responder
#8
Oka gracias a los 2 por sus comentarios si no me anda comentare.
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)