antispam efectivo
#1
que tal uso REHDLS con amxx 1.9
estoy teniendo problemas que entran y tiran IP en el say.
y tambien se conectan con un tag que tiene una IP
necesito un plugin efectivo que los saque o banee por x tiempo.
Responder
#2
(15/02/2021, 11:21 AM)cahervar escribió: que tal uso REHDLS con amxx 1.9
estoy teniendo problemas que entran y tiran IP en el say.
y tambien se conectan con un tag que tiene una IP
necesito un plugin efectivo que los saque o banee por x tiempo.

Funciona y compila bien, si te da algún error checa los include que puede que te falten.

Código PHP:
#include <amxmodx>
#include <fakemeta>
#include <regex>
#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

// Plugin Data
new const PLUGIN[] = "Anti-Spam"
new const VERSION[] = "v2.5.2"
new const AUTHOR[] = "Kane,ReymonARG,"

enum{
    NUM 0,
    POINT 1,
    DPOINT 2,
    WWW 3,
    TOTAL_LTS



public 
client_putinserver(id)
    check_user_name(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)



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"[Anti-Spam] %s Fue kickeado por ponerse una ip en el nombre"name)
            server_cmd("kick %s"name)
        
            
return 1
        
}
    }
    
    
return -1

}

public 
MessageNameChange(msgiddestid)
{
    new szInfo[64

    get_msg_arg_string(2szInfo63

    if(!equali(szInfo"#Cstrike_Name_Change"))
    {
        return PLUGIN_CONTINUE    
    
}
    
    
return PLUGIN_HANDLED
}

public 
hook_say(id)
{
    new args[192], contador[TOTAL_LTS]
    
    read_args
(args191)
    
    replace_all
(args191" """)
    
    
for( new 0strlen(args) ; i++)
    {
        switch(args[i])
        {
            case '0''1''2''3''4''5''6''7''8''9' contador[NUM]++
            
            
case '.' contador[POINT]++
            
            
case ':' contador[DPOINT]++
            
            
case 'w' contador[WWW]++
            
        
}
    }
    
    
if(contador[NUM] >= && contador[POINT] || (contador[WWW] >= && containi(args,".com")))
    {
        client_print(idprint_chat"[Anti-Spam] Mensaje bloqueado. Considerado Spam")
        return PLUGIN_HANDLED
    
}
    return PLUGIN_CONTINUE

// Prefix
new const szPrint[] = "^4[^3Anti-Spam^4]^1 Anti-Spam detecto una^3"

// MsgIds
new msgSayTextg_count_spam[33]

// Regex
new Regex:g_rWebRegex:g_rIpg_iRet

// Default Values
new g_iMaxSpams 5g_iSpamAdd 1

public plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
register_clcmd("say_team""hook_say")
 
register_clcmd("say""hook_say"
 
register_message(get_user_msgid("SayText"), "MessageNameChange")
 
 
// Eventos
 
register_event("HLTV""event_round_start""a""1=0""2=0")
 
 
// Fakemeta
 
register_forward(FM_ClientUserInfoChanged"FMClientUserInfoChanged")
 
 
// MsgIds
 
msgSayText get_user_msgid("SayText")
 
 
// Regex
 
new error[50]
 
 
g_rIp regex_compile("(.+(\s)?\d{1,3}(\.|-|;|:|,|\s+|[A-Za-z])){1,3}"g_iReterrorcharsmax(error), "i")
 
 if (
g_rIp REGEX_OK)
 
log_amx("Error de Regex IP: %d | %s"g_iReterror)
 
 
g_rWeb regex_compile("(^^http(s)://*)*[a-zA-Z0-9\-\.]+(,|\.|>|<)+[A-Za-z]{2,3}"g_iReterrorcharsmax(error), "i")
 
 if (
g_rWeb REGEX_OK)
 
log_amx("Error de Regex Web: %d | %s"g_iReterror)
}

public 
plugin_natives()
{
 
register_native("as_check_string""native_check_string")
 
register_native("as_add_user_count""native_add_user_count")
 
register_native("as_get_spam_count""native_get_spam_count")
 
register_native("as_set_spam_add""native_set_spam_add")
 
register_native("as_set_max_spams""native_set_max_spams")
}

public 
plugin_end()
{
 
regex_free(g_rIp)
 
regex_free(g_rWeb)
}

// as_check_string(const string[], spam[12])
public native_check_string(iPluginiParams)
{
 new 
string[70], spam[12]
 
get_string(1string69)
 
get_string(2spam11)
 
 if (!
string[0] || CheckString(stringspam))
 {
 
set_string(2spam11)
 return 
1;
 }
 
 return 
0;
}

// as_add_user_count(id, iCount = 1)
public native_add_user_count(iPluginiParams)
{
 new 
id get_param(1)
 
 if (!
is_user_connected(id))
 {
 
log_amx("[Anti-Spam] Invlid Id (%d)"id)
 return 
false;
 }
 
 new 
iCount get_param(2)
 
set_count_spam(idiCount)
 
 return 
true;
}

// as_get_spam_count(id)
public native_get_spam_count(iPluginiParams)
{
 new 
id get_param(1)
 
 if (!
is_user_connected(id))
 {
 
log_amx("[Anti-Spam] Invlid Id (%d)"id)
 return -
1;
 }
 
 return 
g_count_spam[id];
}

// as_set_spam_add(num)
public native_set_spam_add(iPluginiParams)
{
 new 
num get_param(1)
 
 
// Sin sentido
 
if (!num || num g_iMaxSpams)
 return 
false;
 
 
g_iSpamAdd num
 
return true;
}

// as_set_max_spams(num)
public native_set_max_spams(iPluginiParams)
{
 new 
num get_param(1)
 
 
// Sin sentido
 
if (!num || num g_iSpamAdd)
 return 
false;
 
 
g_iMaxSpams num
 
return true;
}

public 
event_round_start()
 
chatcolor(0"^4[^3Anti-Spam^4]^1 ^1Este server usa ^4%s %s ^1Creado y Editado por ^3%s"PLUGINVERSIONAUTHOR)

//public client_putinserver(id)
public client_connect(id)
{
 new 
name[32], spam[12]
 
get_user_name(idnamecharsmax(name))
 
 
// Regex Check
 
if (CheckString(namespam))
 {
 
server_cmd("kick #%d ^"Tu nombre tiene una %s en ella^""get_user_userid(id), spam)
 return;
 }
 
 
g_count_spam[id] = 0
}

public 
FMClientUserInfoChanged(id)
{
 if (!
is_user_connected(id)) return FMRES_IGNORED;
 
 
// Name vars
 
static new_name[32], old_name[32];
 
get_user_name(idold_namecharsmax(old_name))
 
get_user_info(id"name"new_namecharsmax(new_name))
 
 
// El mismo nombre..
 
if (equal(new_nameold_name))
 return 
FMRES_IGNORED;
 
 
// Regex Check
 
new spam[12]
 if (
CheckString(new_namespam))
 {
 
set_count_spam(idg_iSpamAdd)
 
set_user_info(id"name"old_name)
 
chatcolor(id"%s %s"szPrintspam)
 return 
FMRES_SUPERCEDE;
 }
 
 
// Set new name
 
set_user_info(id"name"new_name)
 
 return 
FMRES_SUPERCEDE;
}

bool:CheckString(const string[], spam[12])
{
 
// Comparamos la string con nuestro pattern
 
if (regex_match_c(stringg_rIpg_iRet))// || regex_match_c(string, g_rIp2, g_iRet))
 
{
 
formatex(spam3"IP")
 return 
true;
 }
 
// Comparamos la string con nuestro pattern de nuevo
 
else if (regex_match_c(stringg_rWebg_iRet))
 {
 
formatex(spam11"Pagina Web")
 return 
true;
 }
 
 return 
false;
}

set_count_spam(idiCount)

 if (
g_count_spam[id] + iCount >= g_iMaxSpams)
 {
 
server_cmd("kick #%d ^"Intentos multiples de Spam.^""get_user_userid(id))
 return;
 }
 
 
g_count_spam[id] += iCount
 chatcolor
(id"^4[^3Anti-Spam^4]^1 ^1Te quedan ^3%d ^1/ ^3%d ^1para no ser kickeado por ^4Spammer"g_count_spam[id], g_iMaxSpams)
}

stock chatcolor(id, const input[], any:...)
{
 static 
szMsg[191]
 
vformat(szMsg190input3)
 
 
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTmsgSayText, .player id)
 
write_byte(id id 33)
 
write_string(szMsg)
 
message_end()


(15/02/2021, 02:44 PM)-T-E-R-M-I- escribió: Funciona y compila bien, si te da algún error checa los include que puede que te falten.

Código PHP:
#include <amxmodx>
#include <fakemeta>
#include <regex>
#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

// Plugin Data
new const PLUGIN[] = "Anti-Spam"
new const VERSION[] = "v2.5.2"
new const AUTHOR[] = "Kane,ReymonARG,"

enum{
    NUM 0,
    POINT 1,
    DPOINT 2,
    WWW 3,
    TOTAL_LTS



public 
client_putinserver(id)
    check_user_name(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)



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"[Anti-Spam] %s Fue kickeado por ponerse una ip en el nombre"name)
            server_cmd("kick %s"name)
        
            
return 1
        
}
    }
    
    
return -1

}

public 
MessageNameChange(msgiddestid)
{
    new szInfo[64

    get_msg_arg_string(2szInfo63

    if(!equali(szInfo"#Cstrike_Name_Change"))
    {
        return PLUGIN_CONTINUE    
    
}
    
    
return PLUGIN_HANDLED
}

public 
hook_say(id)
{
    new args[192], contador[TOTAL_LTS]
    
    read_args
(args191)
    
    replace_all
(args191" """)
    
    
for( new 0strlen(args) ; i++)
    {
        switch(args[i])
        {
            case '0''1''2''3''4''5''6''7''8''9' contador[NUM]++
            
            
case '.' contador[POINT]++
            
            
case ':' contador[DPOINT]++
            
            
case 'w' contador[WWW]++
            
        
}
    }
    
    
if(contador[NUM] >= && contador[POINT] || (contador[WWW] >= && containi(args,".com")))
    {
        client_print(idprint_chat"[Anti-Spam] Mensaje bloqueado. Considerado Spam")
        return PLUGIN_HANDLED
    
}
    return PLUGIN_CONTINUE

// Prefix
new const szPrint[] = "^4[^3Anti-Spam^4]^1 Anti-Spam detecto una^3"

// MsgIds
new msgSayTextg_count_spam[33]

// Regex
new Regex:g_rWebRegex:g_rIpg_iRet

// Default Values
new g_iMaxSpams 5g_iSpamAdd 1

public plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
register_clcmd("say_team""hook_say")
 
register_clcmd("say""hook_say"
 
register_message(get_user_msgid("SayText"), "MessageNameChange")
 
 
// Eventos
 
register_event("HLTV""event_round_start""a""1=0""2=0")
 
 
// Fakemeta
 
register_forward(FM_ClientUserInfoChanged"FMClientUserInfoChanged")
 
 
// MsgIds
 
msgSayText get_user_msgid("SayText")
 
 
// Regex
 
new error[50]
 
 
g_rIp regex_compile("(.+(\s)?\d{1,3}(\.|-|;|:|,|\s+|[A-Za-z])){1,3}"g_iReterrorcharsmax(error), "i")
 
 if (
g_rIp REGEX_OK)
 
log_amx("Error de Regex IP: %d | %s"g_iReterror)
 
 
g_rWeb regex_compile("(^^http(s)://*)*[a-zA-Z0-9\-\.]+(,|\.|>|<)+[A-Za-z]{2,3}"g_iReterrorcharsmax(error), "i")
 
 if (
g_rWeb REGEX_OK)
 
log_amx("Error de Regex Web: %d | %s"g_iReterror)
}

public 
plugin_natives()
{
 
register_native("as_check_string""native_check_string")
 
register_native("as_add_user_count""native_add_user_count")
 
register_native("as_get_spam_count""native_get_spam_count")
 
register_native("as_set_spam_add""native_set_spam_add")
 
register_native("as_set_max_spams""native_set_max_spams")
}

public 
plugin_end()
{
 
regex_free(g_rIp)
 
regex_free(g_rWeb)
}

// as_check_string(const string[], spam[12])
public native_check_string(iPluginiParams)
{
 new 
string[70], spam[12]
 
get_string(1string69)
 
get_string(2spam11)
 
 if (!
string[0] || CheckString(stringspam))
 {
 
set_string(2spam11)
 return 
1;
 }
 
 return 
0;
}

// as_add_user_count(id, iCount = 1)
public native_add_user_count(iPluginiParams)
{
 new 
id get_param(1)
 
 if (!
is_user_connected(id))
 {
 
log_amx("[Anti-Spam] Invlid Id (%d)"id)
 return 
false;
 }
 
 new 
iCount get_param(2)
 
set_count_spam(idiCount)
 
 return 
true;
}

// as_get_spam_count(id)
public native_get_spam_count(iPluginiParams)
{
 new 
id get_param(1)
 
 if (!
is_user_connected(id))
 {
 
log_amx("[Anti-Spam] Invlid Id (%d)"id)
 return -
1;
 }
 
 return 
g_count_spam[id];
}

// as_set_spam_add(num)
public native_set_spam_add(iPluginiParams)
{
 new 
num get_param(1)
 
 
// Sin sentido
 
if (!num || num g_iMaxSpams)
 return 
false;
 
 
g_iSpamAdd num
 
return true;
}

// as_set_max_spams(num)
public native_set_max_spams(iPluginiParams)
{
 new 
num get_param(1)
 
 
// Sin sentido
 
if (!num || num g_iSpamAdd)
 return 
false;
 
 
g_iMaxSpams num
 
return true;
}

public 
event_round_start()
 
chatcolor(0"^4[^3Anti-Spam^4]^1 ^1Este server usa ^4%s %s ^1Creado y Editado por ^3%s"PLUGINVERSIONAUTHOR)

//public client_putinserver(id)
public client_connect(id)
{
 new 
name[32], spam[12]
 
get_user_name(idnamecharsmax(name))
 
 
// Regex Check
 
if (CheckString(namespam))
 {
 
server_cmd("kick #%d ^"Tu nombre tiene una %s en ella^""get_user_userid(id), spam)
 return;
 }
 
 
g_count_spam[id] = 0
}

public 
FMClientUserInfoChanged(id)
{
 if (!
is_user_connected(id)) return FMRES_IGNORED;
 
 
// Name vars
 
static new_name[32], old_name[32];
 
get_user_name(idold_namecharsmax(old_name))
 
get_user_info(id"name"new_namecharsmax(new_name))
 
 
// El mismo nombre..
 
if (equal(new_nameold_name))
 return 
FMRES_IGNORED;
 
 
// Regex Check
 
new spam[12]
 if (
CheckString(new_namespam))
 {
 
set_count_spam(idg_iSpamAdd)
 
set_user_info(id"name"old_name)
 
chatcolor(id"%s %s"szPrintspam)
 return 
FMRES_SUPERCEDE;
 }
 
 
// Set new name
 
set_user_info(id"name"new_name)
 
 return 
FMRES_SUPERCEDE;
}

bool:CheckString(const string[], spam[12])
{
 
// Comparamos la string con nuestro pattern
 
if (regex_match_c(stringg_rIpg_iRet))// || regex_match_c(string, g_rIp2, g_iRet))
 
{
 
formatex(spam3"IP")
 return 
true;
 }
 
// Comparamos la string con nuestro pattern de nuevo
 
else if (regex_match_c(stringg_rWebg_iRet))
 {
 
formatex(spam11"Pagina Web")
 return 
true;
 }
 
 return 
false;
}

set_count_spam(idiCount)

 if (
g_count_spam[id] + iCount >= g_iMaxSpams)
 {
 
server_cmd("kick #%d ^"Intentos multiples de Spam.^""get_user_userid(id))
 return;
 }
 
 
g_count_spam[id] += iCount
 chatcolor
(id"^4[^3Anti-Spam^4]^1 ^1Te quedan ^3%d ^1/ ^3%d ^1para no ser kickeado por ^4Spammer"g_count_spam[id], g_iMaxSpams)
}

stock chatcolor(id, const input[], any:...)
{
 static 
szMsg[191]
 
vformat(szMsg190input3)
 
 
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTmsgSayText, .player id)
 
write_byte(id id 33)
 
write_string(szMsg)
 
message_end()


pruébalo haber si te funciona en amx 1.9


Archivos adjuntos
.inc   anti_spam.inc (Tamaño: 1.51 KB / Descargas: 5)
Tranquilo Eso Tiene Solución ¿Para que Te Preocupas?, Y si no la Tiene ¡¡Para Que Te Preocupas!! XD
[Imagen: 76561197966849976.png]
Responder
#3
Te dejo esta opción igual

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

#define IsDigit(%0) ( 48 <= %0 <= 57 )
#define MAX_TRIES 4

enum NUM 0POINT 1TOTAL }

new const 
g_szCache_KeyName[] = "name";
new 
g_szPluginInfo[][] = { "Anti spam""1.1""ReymonARG""[ANTISPAM]" }
new 
g_playername[33][32];

public 
plugin_init() {
    
register_plugin(g_szPluginInfo[0], g_szPluginInfo[1], g_szPluginInfo[2]);
    
register_clcmd("say""hooksay_as");
    
register_clcmd("say_team""hooksay_as");
}
public 
client_connect(id) {
    
get_user_name(idg_playername[id], 31);
    
    if(
StringCheck(g_playername[id])) {
        
server_cmd("kick #%d ^"Nombre considerado como SPAM elimina los numeros.^""get_user_userid(id));
    }
}
public 
client_infochanged(id) {
    static 
szName[32];
    
get_user_info(idg_szCache_KeyNameszNamecharsmax(szName));
    
    if(!
equal(szNameg_playername[id])) {
        if(
StringCheck(szName)) {
            
server_cmd("kick #%d ^"Nombre considerado como SPAM elimina los numeros.^""get_user_userid(id));
        }
    }
    return 
PLUGIN_CONTINUE;
}
public 
hooksay_as(id) {
    new 
args[192], contador[TOTAL];
    
read_args(args191);
    
replace_all(args191" """);

    for( new 
0strlen(args) ; i++) {  
        if(
48 <= args[i] <= 57) {  
            
contador[NUM]++  
            
args[i] = 'x'   
        
}  
        if(
args[i] == 46) {  
            
contador[POINT]++  
        }
    } 
    if(
contador[POINT] >= || containi(args"www") != -1) {
        
client_print_color(idprint_team_default"^4%s^1 Mensaje considerado como ^3SPAM^1."g_szPluginInfo[3])
        return 
PLUGIN_HANDLED;
    }
    else if(
contador[NUM] > MAX_TRIES) {
        if(
contador[POINT]) {
            
client_print_color(idprint_team_default"^4%s^1 Mensaje considerado como ^3SPAM^1."g_szPluginInfo[3])
            return 
PLUGIN_HANDLED
        
}
        else {
            
client_print_color(idprint_team_default"^4%s^1 Mensaje considerado como ^3SPAM^1."g_szPluginInfo[3])
            return 
PLUGIN_HANDLED  
        
}
    }
    return 
PLUGIN_CONTINUE 
}
stock StringCheck(const szString[]) {
    static 
iLen,iTries;
    
    
iLen strlen(szString);
    
iTries 0;
    
    for(new 
i;iLen;i++) {
        if(
IsDigit(szString[i]))
            
iTries++;
    }
    return ( 
iTries MAX_TRIES );

Trolleyes
Responder
#4
(15/02/2021, 02:44 PM)-T-E-R-M-I- escribió: Funciona y compila bien, si te da algún error checa los include que puede que te falten.

Código PHP:
#include <amxmodx>
#include <fakemeta>
#include <regex>
#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

// Plugin Data
new const PLUGIN[] = "Anti-Spam"
new const VERSION[] = "v2.5.2"
new const AUTHOR[] = "Kane,ReymonARG,"

enum{
    NUM 0,
    POINT 1,
    DPOINT 2,
    WWW 3,
    TOTAL_LTS



public 
client_putinserver(id)
    check_user_name(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)



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"[Anti-Spam] %s Fue kickeado por ponerse una ip en el nombre"name)
            server_cmd("kick %s"name)
        
            
return 1
        
}
    }
    
    
return -1

}

public 
MessageNameChange(msgiddestid)
{
    new szInfo[64

    get_msg_arg_string(2szInfo63

    if(!equali(szInfo"#Cstrike_Name_Change"))
    {
        return PLUGIN_CONTINUE    
    
}
    
    
return PLUGIN_HANDLED
}

public 
hook_say(id)
{
    new args[192], contador[TOTAL_LTS]
    
    read_args
(args191)
    
    replace_all
(args191" """)
    
    
for( new 0strlen(args) ; i++)
    {
        switch(args[i])
        {
            case '0''1''2''3''4''5''6''7''8''9' contador[NUM]++
            
            
case '.' contador[POINT]++
            
            
case ':' contador[DPOINT]++
            
            
case 'w' contador[WWW]++
            
        
}
    }
    
    
if(contador[NUM] >= && contador[POINT] || (contador[WWW] >= && containi(args,".com")))
    {
        client_print(idprint_chat"[Anti-Spam] Mensaje bloqueado. Considerado Spam")
        return PLUGIN_HANDLED
    
}
    return PLUGIN_CONTINUE

// Prefix
new const szPrint[] = "^4[^3Anti-Spam^4]^1 Anti-Spam detecto una^3"

// MsgIds
new msgSayTextg_count_spam[33]

// Regex
new Regex:g_rWebRegex:g_rIpg_iRet

// Default Values
new g_iMaxSpams 5g_iSpamAdd 1

public plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
register_clcmd("say_team""hook_say")
 
register_clcmd("say""hook_say"
 
register_message(get_user_msgid("SayText"), "MessageNameChange")
 
 
// Eventos
 
register_event("HLTV""event_round_start""a""1=0""2=0")
 
 
// Fakemeta
 
register_forward(FM_ClientUserInfoChanged"FMClientUserInfoChanged")
 
 
// MsgIds
 
msgSayText get_user_msgid("SayText")
 
 
// Regex
 
new error[50]
 
 
g_rIp regex_compile("(.+(\s)?\d{1,3}(\.|-|;|:|,|\s+|[A-Za-z])){1,3}"g_iReterrorcharsmax(error), "i")
 
 if (
g_rIp REGEX_OK)
 
log_amx("Error de Regex IP: %d | %s"g_iReterror)
 
 
g_rWeb regex_compile("(^^http(s)://*)*[a-zA-Z0-9\-\.]+(,|\.|>|<)+[A-Za-z]{2,3}"g_iReterrorcharsmax(error), "i")
 
 if (
g_rWeb REGEX_OK)
 
log_amx("Error de Regex Web: %d | %s"g_iReterror)
}

public 
plugin_natives()
{
 
register_native("as_check_string""native_check_string")
 
register_native("as_add_user_count""native_add_user_count")
 
register_native("as_get_spam_count""native_get_spam_count")
 
register_native("as_set_spam_add""native_set_spam_add")
 
register_native("as_set_max_spams""native_set_max_spams")
}

public 
plugin_end()
{
 
regex_free(g_rIp)
 
regex_free(g_rWeb)
}

// as_check_string(const string[], spam[12])
public native_check_string(iPluginiParams)
{
 new 
string[70], spam[12]
 
get_string(1string69)
 
get_string(2spam11)
 
 if (!
string[0] || CheckString(stringspam))
 {
 
set_string(2spam11)
 return 
1;
 }
 
 return 
0;
}

// as_add_user_count(id, iCount = 1)
public native_add_user_count(iPluginiParams)
{
 new 
id get_param(1)
 
 if (!
is_user_connected(id))
 {
 
log_amx("[Anti-Spam] Invlid Id (%d)"id)
 return 
false;
 }
 
 new 
iCount get_param(2)
 
set_count_spam(idiCount)
 
 return 
true;
}

// as_get_spam_count(id)
public native_get_spam_count(iPluginiParams)
{
 new 
id get_param(1)
 
 if (!
is_user_connected(id))
 {
 
log_amx("[Anti-Spam] Invlid Id (%d)"id)
 return -
1;
 }
 
 return 
g_count_spam[id];
}

// as_set_spam_add(num)
public native_set_spam_add(iPluginiParams)
{
 new 
num get_param(1)
 
 
// Sin sentido
 
if (!num || num g_iMaxSpams)
 return 
false;
 
 
g_iSpamAdd num
 
return true;
}

// as_set_max_spams(num)
public native_set_max_spams(iPluginiParams)
{
 new 
num get_param(1)
 
 
// Sin sentido
 
if (!num || num g_iSpamAdd)
 return 
false;
 
 
g_iMaxSpams num
 
return true;
}

public 
event_round_start()
 
chatcolor(0"^4[^3Anti-Spam^4]^1 ^1Este server usa ^4%s %s ^1Creado y Editado por ^3%s"PLUGINVERSIONAUTHOR)

//public client_putinserver(id)
public client_connect(id)
{
 new 
name[32], spam[12]
 
get_user_name(idnamecharsmax(name))
 
 
// Regex Check
 
if (CheckString(namespam))
 {
 
server_cmd("kick #%d ^"Tu nombre tiene una %s en ella^""get_user_userid(id), spam)
 return;
 }
 
 
g_count_spam[id] = 0
}

public 
FMClientUserInfoChanged(id)
{
 if (!
is_user_connected(id)) return FMRES_IGNORED;
 
 
// Name vars
 
static new_name[32], old_name[32];
 
get_user_name(idold_namecharsmax(old_name))
 
get_user_info(id"name"new_namecharsmax(new_name))
 
 
// El mismo nombre..
 
if (equal(new_nameold_name))
 return 
FMRES_IGNORED;
 
 
// Regex Check
 
new spam[12]
 if (
CheckString(new_namespam))
 {
 
set_count_spam(idg_iSpamAdd)
 
set_user_info(id"name"old_name)
 
chatcolor(id"%s %s"szPrintspam)
 return 
FMRES_SUPERCEDE;
 }
 
 
// Set new name
 
set_user_info(id"name"new_name)
 
 return 
FMRES_SUPERCEDE;
}

bool:CheckString(const string[], spam[12])
{
 
// Comparamos la string con nuestro pattern
 
if (regex_match_c(stringg_rIpg_iRet))// || regex_match_c(string, g_rIp2, g_iRet))
 
{
 
formatex(spam3"IP")
 return 
true;
 }
 
// Comparamos la string con nuestro pattern de nuevo
 
else if (regex_match_c(stringg_rWebg_iRet))
 {
 
formatex(spam11"Pagina Web")
 return 
true;
 }
 
 return 
false;
}

set_count_spam(idiCount)

 if (
g_count_spam[id] + iCount >= g_iMaxSpams)
 {
 
server_cmd("kick #%d ^"Intentos multiples de Spam.^""get_user_userid(id))
 return;
 }
 
 
g_count_spam[id] += iCount
 chatcolor
(id"^4[^3Anti-Spam^4]^1 ^1Te quedan ^3%d ^1/ ^3%d ^1para no ser kickeado por ^4Spammer"g_count_spam[id], g_iMaxSpams)
}

stock chatcolor(id, const input[], any:...)
{
 static 
szMsg[191]
 
vformat(szMsg190input3)
 
 
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTmsgSayText, .player id)
 
write_byte(id id 33)
 
write_string(szMsg)
 
message_end()



pruébalo haber si te funciona en amx 1.9

Perdon por revivir esto, pero intente con el plugin de Kane, y no me funcionó, supuestamente me bloquea el mensaje pero de igual manera lo envia en el say, osea todo el mundo lo ve, lo unico que si hace es que si intento ponerme una IP en el tag lo bloquea, pero de resto no.
Responder
#5
(02/05/2021, 03:21 PM)gmartinez escribió: Perdon por revivir esto, pero intente con el plugin de Kane, y no me funcionó, supuestamente me bloquea el mensaje pero de igual manera lo envia en el say, osea todo el mundo lo ve, lo unico que si hace es que si intento ponerme una IP en el tag lo bloquea, pero de resto no.



Tienes otro plugin que hookea el say
Estoy cansado de este sufrimiento llamado vivir en Venezuela
Okay
Responder
#6
(04/05/2021, 03:57 PM)samueldmq escribió: Tienes otro plugin que hookea el say

Si Amigo Samuel gracias a una respuesta tuya lo resolvi, será que me puedes ayudar con otro PLUGIN que te envie al Privado
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)