Cooldown for citizen

Hello.

I’d like to ask if somebody knows how can I make a cooldown for specific citizen.
For example, citizen using /report, it won’t let him do the command again… until 10 seconds has passed.

How can I do that?

Citizen.Wait(msec) add this at the end of command for example:

RegisterCommand(‘report’, function ()
TriggerEvent(‘xyz:report’)
Citizen.Wait(10000)
end)

I did exactly the same but another client can’t use it…

If I did /report it shows to all client that they need to wait 10 seconds…
I need someting that work on specific client… if he should wait 10 seconds the other client won’t be needed to wait them too.

Use ‘local cooldowns = {}’ at the top of your script. Then use this piece of code; (make sure to use this in server.lua)

RegisterCommand(‘commandName’, function (source, args, rawCommand)
local src = source
if cooldown[src] then
--notification that the player is on cooldown
return
end
--here goes your code....
cooldowns[src] = true
Citizen.SetTimeout(5000, function()
cooldown[src] = false
end)
end, false)

The number 5000 is 5 seconds. You can change this to anything you want.

Thank you a lot, king.