I'm using so-called ACFP (Anti command-flood protection) routines I did for my needs. Might be helpful to you ...
Code:
#define ACFP_TOLERANCE 3
new ACFP_memory[32];
override_ACFP(id)
{
ACFP_memory[id] = 0;
return;
}
bool:passed_ACFP(id, print_target)
{
new t = get_systime();
if (t - ACFP_memory[id] >= ACFP_TOLERANCE)
{
ACFP_memory[id] = t;
return true;
}
switch (print_target)
{
case print_chat: chat(id, "Anti-Command-Flood: %d sec.", ACFP_TOLERANCE);
case print_console: console(id, "Anti-Command-Flood: %d sec.", ACFP_TOLERANCE);
case print_center: center(id, "Anti-Command-Flood: %d sec.", ACFP_TOLERANCE);
}
return false;
}
To use it, I just call it like this:
Code:
public my_console_command(id)
{
if (!passed_ACFP(id, print_console)) return PLUGIN_HANDLED;
// command code here ...
}
__________________