Raised This Month: $12 Target: $400
 3% 

[REQ] Commands Cooldown


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 12-24-2016 , 07:12   [REQ] Commands Cooldown
Reply With Quote #1

I already know how to do this.
__________________

Last edited by Relaxing; 03-30-2018 at 18:49.
Relaxing is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 12-25-2016 , 18:05   Re: [REQ] Commands Cooldown
Reply With Quote #2

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

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 12-28-2016 , 13:51   Re: [REQ] Commands Cooldown
Reply With Quote #3

The god if pawn...
__________________
Relaxing is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 12-29-2016 , 11:11   Re: [REQ] Commands Cooldown
Reply With Quote #4

Quote:
Originally Posted by Relaxing View Post
The god if pawn...
Far from but okay, nice to see you're happy xD
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Reply


Thread Tools
Display Modes

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 17:19.


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