Standalone cooldown system with options for both player-specific and global actions. It provides an efficient way to track and enforce cooldowns for various gameplay mechanics, ensuring consistent behaviour across different frameworks or custom implementations.
Client Functions
check_cooldown
Used to check if something is on cooldown from the client.
--- Define the typelocal cooldown_type ='action_type'--- Specify if cooldown is globallocal is_global =false--- Utils objectutils.cooldowns.check(cooldown_type, is_global, function(is_on_cooldown)if is_on_cooldown thenprint('Player-specific action is currently on cooldown.')elseprint('Player-specific action is available.')endend)--- Direct exportexports.boii_utils:check_cooldown(...)
Server Functions
add_cooldown
Use the following to add a cooldown, you can specfiy if this should be specific to the player or global (server wide).
--- Specify unique idlocal cooldown_id ='id1234'--- Specify cooldown timein seconds (s)local cooldown_time =30--- Specify if is global if false cooldowns are attached to players sourcelocal is_global =false--- Utils objectutils.cooldowns.add(source, cooldown_id, cooldown_time, is_global)--- Direct exportexports.boii_utils:add_cooldown(source, cooldown_id, cooldown_time, is_global)
check_cooldown
Use the following to check the current status of a cooldown.
--- Specify unique idlocal cooldown_id ='id1234'--- Specify if is global if false we check cooldowns attached to players sourcelocal is_global =false--- Utils objectutils.cooldowns.check(source, cooldown_id, is_global)--- Direct exportexports.boii_utils:check_cooldown(source, cooldown_id, is_global)
clear_cooldown
Use the following to clear a specific cooldown.
--- Specify unique idlocal cooldown_id ='id1234'--- Specify if is global if false we check cooldowns attached to players sourcelocal is_global =false--- Utils objectutils.cooldowns.clear(cooldown_id, is_global)--- Direct exportexports.boii_utils:clear_cooldown(cooldown_id, is_global)
clear_resource_cooldowns
Use the following to clear all cooldowns attached to a resource.
--- Specify resource namelocal resource_name ='your_resource'--- Utils objectutils.cooldowns.clear_reosurce_cooldowns(resource_name)--- Direct exportexports.boii_utils:clear_reosurce_cooldowns(resource_name)