AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [REQ] Commands Cooldown (https://forums.alliedmods.net/showthread.php?t=291874)

Relaxing 12-24-2016 07:12

[REQ] Commands Cooldown
 
I already know how to do this.

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(PLUGINVERSIONAUTHOR)
    
    for(new 
isizeof(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(idprint_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



Relaxing 12-28-2016 13:51

Re: [REQ] Commands Cooldown
 
The god if pawn...

Napoleon_be 12-29-2016 11:11

Re: [REQ] Commands Cooldown
 
Quote:

Originally Posted by Relaxing (Post 2481339)
The god if pawn...

Far from but okay, nice to see you're happy xD


All times are GMT -4. The time now is 10:17.

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