Need Help Creating A Cooldown Timer as a command /tlks

-- RegisterCommand("tlks", function(source)

--     local ped = PlayerPedId()
--     local currentPos = GetEntityCoords(ped)
--     print(currentPos)

--     SetPedCoordsKeepVehicle(ped, 674.883, 548.269, 133.94, false, false, false, true)
--     Citizen.Wait(60000)

--     currentPos = GetEntityCoords(ped)
    
--     print(currentPos) -- changed!

-- end)

This is my code, how do I add a cooldown time for him and send a notification during the cooldown time?

Look into the code of this script:

Try This

local Cooldown = false

– RegisterCommand(“tlks”, function()
– if Cooldown == false then
– local ped = PlayerPedId()
– local currentPos = GetEntityCoords(ped)
– print(currentPos)

– notify(“Command executed”)

– SetPedCoordsKeepVehicle(ped, 674.883, 548.269, 133.94, false, false, false, true)

– Cooldown = true

– Citizen.Wait(60000)

– Cooldown = false

– currentPos = GetEntityCoords(ped)

– print(currentPos)
– else
– notify(“Wait till you can execute this command again”)
– end
– end)

– function notify(msg)
– SetNotificationTextEntry(“STRING”)
– AddTextComponentString(msg)
– DrawNotification(true,false)
– end

Special thanks to you, it worked for me! Do you know how to add the option to pay for it?

thank you for your reply! I’ve found a solution

What do you mean pay for it? Support is free :stuck_out_tongue:

Hahaha I mean after entering this code player need to pay for it

Not sure what you mean, can you elaborate?

What I mean, when the player enters this command, the system will deduct money from it