Raised This Month: $ Target: $400
 0% 

Delay before re-use


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
alien
Senior Member
Join Date: Aug 2005
Location: London || Slovakia
Old 12-02-2007 , 13:48   Re: Delay before re-use
Reply With Quote #2

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 ...   }
__________________
alien is offline
Send a message via ICQ to alien
 



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 11:00.


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