AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   My AutoBan plugin is not working (based on SwearReplacements) (https://forums.alliedmods.net/showthread.php?t=62728)

AnHiMiLaToR 11-03-2007 19:34

My AutoBan plugin is not working (based on SwearReplacements)
 
Please help me!
When I say some word from the ban.ini file it doesn't ban me... :(

Here's the code:
PHP Code:

#include <amxmodx>
#include <amxmisc> 
#define MAX_WORDS 200
new g_banWords[MAX_WORDS][200]
new 
g_banNum

public plugin_init()
{
    
register_plugin "Auto BAN""1.0""kaboomkazoom & AnHiMiLaToR")
    
register_concmd "aban_add""aban_add"ADMIN_LEVEL_A "" )
    
readList()
}

readList()
{
    new 
Configsdir[64]
    new 
ban_file[64]
    
get_configsdirConfigsdir63 )
    
format(ban_file63"%s/ban.ini"Configsdir )
    

    if ( !
file_exists(ban_file) )
    {
        
server_print "==========================================================" )
        
server_print "[Auto BAN] %s file not found"ban_file )
        
server_print "==========================================================" )
        return
    }
    
    new 
leni=0
    
while( MAX_WORDS && read_fileban_fileg_banWords[g_banNum], 19len ) )
    {
        
i++
        if( 
g_banWords[g_banNum][0] == ';' || len == )
            continue
        
g_banNum++
    }


}


public 
bancheck(id)
    {

    new 
said[192]
    
read_args said191 )

    new 
0
    
while ( g_banNum )
    {
        if ( 
containi saidg_banWords[i++] ) != -)
        {
            new 
user_name[32]
            
get_user_name iduser_name31 )
            
server_cmd("amx_ban %s 0 ^"[Auto BANYou have hackSo you got ownedWhy you banned: %s^""user_namesaid)
            
server_cmd("amx_tsay green ^"[Auto BAN] %s bannedHe said '%s' which is not permitted or it's a hack^"", user_name, said)
            server_cmd("amx_chat ^"[Auto BAN] %s banned. He said '
%s' which is not permitted or it's a hack^""user_namesaid)
            
log_amx("[AUTO BAN] Banned '%s' permanently, he said the denied word(s): %s"user_namesaid)
                    

            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE
}




public 
aban_add(id)
{
    if ( ( !(
get_user_flags(id)&ADMIN_LEVEL_A) && id ) )
    {
        
client_print idprint_console"[Auto BAN] Access Denied" )
         return 
PLUGIN_HANDLED
    
}

    if ( 
read_argc() == )
    {
        
client_print idprint_console"[Auto BAN] Arguments not provided" )
         return 
PLUGIN_HANDLED
    
}

    new 
Configsdir[64]
    new 
ban_file[64]
    
get_configsdirConfigsdir63 )
    
format ban_file63"%s/ban.ini"Configsdir )

    
read_args g_banWords[g_banNum], 19 )
    
write_fileban_file"" )
    
write_fileban_fileg_banWords[g_banNum] )
    
g_banNum++

    
id client_print idprint_console"[Auto BAN] Ban string added to the ini file." ) : server_print "[Auto BAN] Ban string added to the ini file." )

    return 
PLUGIN_HANDLED



YamiKaitou 11-03-2007 19:51

Re: My AutoBan plugin is not working (based on SwearReplacements)
 
And where are you catching what the client says?

AnHiMiLaToR 11-03-2007 19:54

Re: My AutoBan plugin is not working (based on SwearReplacements)
 
Here?
I'm just newbie so I will be hapy if you help me. :)
PHP Code:

public bancheck(id
    { 

    new 
said[192
    
read_args said191 

    new 

    
while ( g_banNum 
    { 
        if ( 
containi saidg_banWords[i++] ) != -
        { 
            new 
user_name[32
            
get_user_name iduser_name31 
            
server_cmd("amx_ban %s 0 ^"[Auto BANYou have hackSo you got ownedWhy you banned: %s^""user_namesaid
            
server_cmd("amx_tsay green ^"[Auto BAN] %s bannedHe said '%s' which is not permitted or it's a hack^"", user_name, said) 
            server_cmd("amx_chat ^"[Auto BAN] %s banned. He said '
%s' which is not permitted or it's a hack^""user_namesaid
            
log_amx("[AUTO BAN] Banned '%s' permanently, he said the denied word(s): %s"user_namesaid
                     

            return 
PLUGIN_HANDLED 
        

    } 
    return 
PLUGIN_CONTINUE 



YamiKaitou 11-03-2007 20:03

Re: My AutoBan plugin is not working (based on SwearReplacements)
 
PHP Code:

register_clcmd("say","bancheck");
register_clcmd("say_team","bancheck"); 

Put that in the plugin_init function. That is how you catch what someone is saying

AnHiMiLaToR 11-03-2007 20:07

Re: My AutoBan plugin is not working (based on SwearReplacements)
 
So that will make it to check automatically when user says something ?

Edit: Thanks, it works. :)

TinCan 11-24-2007 10:41

Re: My AutoBan plugin is not working (based on SwearReplacements)
 
Off topic but does anyone else find humor in the fact that it will amx_tsay the word that just banned a player?


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

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