33 lines
838 B
Lua
33 lines
838 B
Lua
QBCore = exports['qb-core']:GetCoreObject()
|
|
local Cooldown = false
|
|
|
|
|
|
RegisterNetEvent('nc-gardening:server:pagamento', function(total)
|
|
local Player = QBCore.Functions.GetPlayer(source)
|
|
|
|
if Player.PlayerData.job.name ~= Config.job then return end
|
|
|
|
Player.Functions.AddMoney(Config.paymentmethod, total, "Gartner kommission")
|
|
end)
|
|
|
|
--Cooldown
|
|
RegisterServerEvent('nc-gardening:Server:BeginCooldown')
|
|
AddEventHandler('nc-gardening:Server:BeginCooldown', function()
|
|
Cooldown = true
|
|
local timer = 60 * 1000
|
|
while timer > 0 do
|
|
Wait(1000)
|
|
timer = timer - 1000
|
|
if timer == 0 then
|
|
Cooldown = false
|
|
end
|
|
end
|
|
end)
|
|
|
|
QBCore.Functions.CreateCallback('nc-gardening:cooldown', function(source, cb)
|
|
if Cooldown then
|
|
cb(true)
|
|
else
|
|
cb(false)
|
|
end
|
|
end) |