AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   problem with regex (https://forums.alliedmods.net/showthread.php?t=156746)

jimaway 05-11-2011 10:04

problem with regex
 
i made this plugin that blocks people from saying ip-s, it works fine if i test it, but sometimes i still see some lines that should be blocked on server.

PHP Code:

public sayCmd(id) {
    new 
input[192]
    
read_args(input,192)
    if (
containsIps(input)) {
        if (
hoiatused[id] < 3) {
            
hoiatused[id]++
            
client_print(idprint_chat"[AntiSpam] ära spammi! hoiatus: %d"hoiatused[id])
        }
        else {
            
server_cmd("amx_ban 60 #%d Spam detected!",get_user_userid(id))
        }
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

bool:containsIps(input[]) {
    new 
numerror[128]
    new 
bool:retval false
    
new Regex:result regex_match(inputPATTERNnumerror127)
    if (
result >= REGEX_OK) {
        
regex_free(result)
        
retval true
    
}
    return 
retval


im thinking that maby this aint working fast enough and if people spam rapidly, some lines get trough (they do get banned after a while, so the problem isnt in the pattern)
should i maby create array with regex tag and use random indexes?


All times are GMT -4. The time now is 04:24.

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