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

problem with regex


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 05-11-2011 , 10:04   problem with regex
Reply With Quote #1

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?
jimaway is offline
Old 05-12-2011, 04:01
rongda
This message has been deleted by Exolent[jNr]. Reason: Spambot
Reply


Thread Tools
Display Modes

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 14:54.


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