Skip to content

A Standalone Server-Side Cooldown Resource

License

Notifications You must be signed in to change notification settings

swkeep/keep-cooldown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

keep-cooldown

  • A small fivem resource to make server-side cooldowns
  • check wiki for more information

Guide

Youtube video

installation

  • insert sql.sql into your database
  • copy files
  • ensure keep-cooldown
  • done

Dependencies

  • oxmysql

example

-- client-side
local CD = exports["keep-cooldown"]:CD()

local cd_id =
    CD.add(
    {
        id = "keep_blackmarket_payphone" .. PlayerPedId(),
        cooldownLength = 30,
        cType = "temporary" -- or persistent
    }
)

local state, remaining = CD.isOnCooldown(cd_id)

if state then
    print("on CD " .. remaining)
    return
end

if not state then
    CD.setOnCooldown(cd_id)
end
--server-side
local CD = exports["keep-cooldown"]:CD()

local cd_id =
    CD.add(
    {
        id = "keep_blackmarket_payphone_2",
        cooldownLength = 30,
        cType = "persistent" -- or persistent
    }
)

local state, remaining = CD.isOnCooldown(cd_id)
print(state, remaining)
if state then
    print("on CD " .. remaining)
    return
end

if not state then
    CD.setOnCooldown(cd_id)
end

state, remaining = CD.isOnCooldown(cd_id)
print(state, remaining)

Support