Quote:
Originally Posted by Relaxing
Code:
#include <amxmodx>
#include <regex>
#define PATTERN "(\d.*){8}"
new whitelist[][] = {
"123.456.789.101:27099",
"123.456.789.101",
"yeah"
}
new Regex:re, ret;
public plugin_init(){
register_clcmd("say", "clcmd_say");
register_clcmd("say_team", "clcmd_say");
new err[32];
re = regex_compile(PATTERN, ret, err, 31, "i");
if (re!=REGEX_OK) log_amx("Error: %s (%d)", err, ret);
}
public plugin_end() {
regex_free(re);
}
public clcmd_say(id){
new arg[64], bool: whitestlist;
read_args(arg, charsmax(arg));
remove_quotes(arg);
trim(arg);
for (new i = 0; i < sizeof(whitelist); i++){
if (contain(arg, whitelist[i])){
whitestlist = true;
break;
}
}
if (strlen(arg) > 7 && !whitestlist){
new match = regex_match_c(arg, re, ret);
if (match > 0){
client_print(id, print_chat, "More digits are not allowed in a single message to avoid IP spam.")
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
|
I was either looking for or planning to do something like that but if you already send then you better do
Testing the system
Quote:
identifies USER with an IP address
|
of over X digits so that will simply give KICK
And preferably without a checklist for the following reasons:
Because you have to write something there every time to block it is better to do a test for a user who enters the server \ who changes there and writes in chat.
I would love you to
EDIT:
Quote:
For other players who want to use this code: Block 7 numbers is pretty bad, because for example there are SERVERS who use a particular EVENT that has a name to type X numbers in chat for winning and that will block them
|