Napoleon_be |
12-25-2016 18:05 |
Re: [REQ] Commands Cooldown
Untested, i suggest you putting this plugin on the top of your plugins.ini file.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx> #include <amxmisc>
#define PLUGIN "amx_cooldown" #define VERSION "1.0" #define AUTHOR "NapoleoN#"
new szCommands[] = { "amx_slap", "amx_slay", "amx_kick", "amx_ban", "amx_banip" }
new pCvarCooldown new iCommand[33] new bool:bCommand[33]
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) for(new i; i < sizeof(szCommands); i++) { register_clcmd(szCommands[i], "CmdCommand") } pCvarCooldown = register_cvar("amx_cmdcooldown", "300.0") // Must always be a float: 1 = 1.0 }
public CmdCommand(id) { if(!(get_user_flags(id) & ADMIN_SLAY)) { return PLUGIN_HANDLED } iCommand[id]++ if(iCommand[id] == 2) { bCommand[id] = true iCommand[id] = 0 set_task(get_pcvar_float(pCvarCooldown), "CmdRemoveCooldown", id) return PLUGIN_HANDLED } if(bCommand[id] == true) { client_print(id, print_center, "[AMXX] You're currently on a cooldown of 5 minutes") return PLUGIN_HANDLED } return PLUGIN_HANDLED }
public CmdRemoveCooldown(id) { if(!is_user_connected(id)) { return PLUGIN_HANDLED } iCommand[id] = 0 bCommand[id] = false return PLUGIN_HANDLED }
|