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(id, print_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 num, error[128]
new bool:retval = false
new Regex:result = regex_match(input, PATTERN, num, error, 127)
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?