Raised This Month: $51 Target: $400
 12% 

Como ocultar o bloquear mensajes con empezados con /


  
 
 
Thread Tools Display Modes
Author Message
LA_BANDA
BANNED
Join Date: Jun 2012
Location: Santiago
Old 07-10-2012 , 07:09   Como ocultar o bloquear mensajes con empezados con /
#1

Tengo el antispam supongo que se puede agregar hay... o ya esta agregado nose la cuestion es que quiero que cuando escriban /cam en mi sv no salga diciendolo... me explico:
no quiero que salga asi:
LA BANDA: /cam
que no salga nada como si no hubiera dicho nada
mi AntiSpam:
PHP Code:
Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <zombieplague>
#include <regex>
#include <zmvip>

#define PLUGIN2 "[AntiSpam]"
#define PLUGIN "[CHAT]"
#define VERSION "2.0"
#define AUTHOR "Sambuseti"

#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]?)"

new const block[][] = { "%s""%d""^1""^3""^4" // Block Say

new name2[32], g_access[33], g_spam[32], cvar_spamcvar_time_kick

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
cvar_spam register_cvar("amx_spam_count""0")
    
cvar_time_kick register_cvar("amx_spam_time_kick""0")

    
register_clcmd("say""Say")
    
register_clcmd("say_team""Say")

    
register_message(get_user_msgid("SayText"), "MessageNameChange")
}

public 
client_putinserver(id)
{
    
get_user_name(idname2[id], charsmax(name2[]))
    
replace_all(name2[id], charsmax(name2), "'""")
    
check_user_name(id)
    
g_spam[id] = get_pcvar_num(cvar_spam)
    
check_class(id)
}

/*================================================================================
[Sistem Say]
=================================================================================*/

public Say(id)
{
    new 
say[192], name[32]
    
read_args(say191)
    
remove_quotes(say)

    
get_user_name(idnamesizeof name 1)
    
    if(
equal(say""))
        return 
PLUGIN_HANDLED

    
for (new 0sizeof blocki++)
    {
        if(
contain(sayblock[i]) != -1)
            return 
PLUGIN_HANDLED

    
}

    new 
g_returnvalueg_error[64]
    new 
Regex:g_result regex_match(sayPATTERNg_returnvalueg_error63)

    switch(
g_result)
    {
        case 
REGEX_MATCH_FAILREGEX_PATTERN_FAIL:
        {
            return 
log_amx("REGEX ERROR! %s"g_error)
        }
        case 
REGEX_NO_MATCH:
        {
            
check_class(id)
            static class[
15]
    
            switch (
g_access[id])
            {
                case 
1formatex(class, 14"^4[VIP]")
                case 
2formatex(class, 14"^4[ADMIN]")
                case 
3formatex(class, 14"^4[ADMIN-JEFE]")
            }

            
client_printc(0"%s^1%s^3%s^1---->^3 %s", (is_user_alive(id) ? "" "^4~^1MUERTO^4~ "), class, namesay)
        }
        default:
        {
            
g_spam[id]--

            if(
g_spam[id] <= && g_spam[id] >= 1)
                
client_printc(id""PLUGIN2g_spam[id], g_spam[id] == "" "es")

            if(
g_spam[id] == 0)
                
server_cmd("amx_kick ^"%s^" ^"Spamero No Queremos^""name)

            
client_printc(id""PLUGIN2)

            return 
PLUGIN_HANDLED
        
}
    }
    
    return 
PLUGIN_HANDLED
}

check_class(id)
{
    if(
get_user_flags(id) & ADMIN_RESERVATION)
        
g_access[id] = 1
    
else if(get_user_flags(id) & ADMIN_IMMUNITY)
        
g_access[id] = 2
    
else if(get_user_flags(id) & ADMIN_RCON)
        
g_access[id] = 3
}

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)

    return 
PLUGIN_HANDLED
}

public 
Kickear(id)
{
    new 
name[33]
    
get_user_name(idname32)
    
client_printc(0""PLUGIN2name2[id])
    
server_cmd("amx_kick ^"%s^" ^"Spameros No Queremos^""name)
}

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:    check_class(id)
        default:
        {
            
client_printc(id""PLUGIN2)
            
client_cmd(id"name ^"Intento Spammear^"")
            
set_task(get_pcvar_float(cvar_time_kick), "Kickear"id)
            
check_class(id)

            return 
1
        
}
    }
    
    return -
1
}

stock client_printc(const id,const input[], any:...) 

    new 
msg[191], players[32], count 1
    
vformat(msg,190,input,3); 
    
replace_all(msg,190,"^4","^4");// green 
    
replace_all(msg,190,"^1","^1");// normal 
    
replace_all(msg,190,"^3","^3");// team 
    
if (idplayers[0] = id; else get_players(players,count,"ch"); 
    for (new 
i=0;i<count;i++) 
    { 
        if (
is_user_connected(players[i])) 
        { 
            
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]); 
            
write_byte(players[i]); 
            
write_string(msg); 
            
message_end(); 
        } 
    } 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang3082{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/ 
debo agregarle excepciones en ¿?¿? como deberia ponerle?? D:
PHP Code:
#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]?) 
LA_BANDA is offline
Send a message via MSN to LA_BANDA
!Morte
Veteran Member
Join Date: May 2010
Old 07-10-2012 , 10:48   Re: Como ocultar o bloquear mensajes con empezados con /
#2

En la funcion que llama /cam agregas un return PLUGIN_HANDLED; al final y listo, cuando lo escribis por say no sale
__________________
First Zombie Class
[ZP] Zombie Class: Houndeye Zombie
Quote:
Originally Posted by lucas_7_94 View Post
tenes que saber pawn antes de intentar hacer algo digno.
!Morte is offline
Send a message via MSN to !Morte Send a message via Skype™ to !Morte
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode