Update cocaine.lua

This commit is contained in:
Mustache Dom authored and GitHub committed 2024-08-26 15:49:35 -07:00
1 parent 7e2b23b9bd
commit c9f4e8114b
1 file changed
+27 -10
+27 -10
View File
@@ -3,24 +3,42 @@ local CocaPlant = {}
local cuttingcoke = nil local cuttingcoke = nil
local baggingcoke = nil local baggingcoke = nil
local function pick(loc)
if not progressbar(Lang.Coke.picking, 4000, 'uncuff') then return end
TriggerServerEvent("coke:pickupCane", loc)
return true
end
RegisterNetEvent('coke:respawnCane', function(loc) RegisterNetEvent('coke:respawnCane', function(loc)
local v = GlobalState.CocaPlant[loc] local v = GlobalState.CocaPlant[loc]
local hash = GetHashKey(v.model) local hash = GetHashKey(v.model)
if not CocaPlant[loc] then if not CocaPlant[loc] then
CocaPlant[loc] = CreateObject(hash, v.location, false, true, true) CocaPlant[loc] = CreateObject(hash, v.location, false, true, true)
Freeze(CocaPlant[loc], true, v.heading) Freeze(CocaPlant[loc], true, v.heading)
exports['qb-target']:AddTargetEntity(CocaPlant[loc], { local options = {
options = { { {
icon = "fas fa-hand", icon = "fas fa-hand",
label = "pick Cocaine", label = "pick Cocaine",
action = function() action = function()
if not progressbar(Lang.Coke.picking, 4000, 'uncuff') then return end if not pick(loc) then return end
TriggerServerEvent("coke:pickupCane", loc)
end end
} }
}, }
distance = 2.5 local optionsox = {
}) {
icon = "fas fa-hand",
label = "pick Cocaine",
distance = 2.5,
onselect = function()
if not pick(loc) then return end
end
}
}
if Config.oxtarget then
exports.ox_target:AddLocalEntity(CocaPlant[loc], {options = options, distance = 2.5})
else
exports['qb-target']:AddTargetEntity(CocaPlant[loc], {options = options, distance = 2.5})
end
end end
end) end)
@@ -41,9 +59,8 @@ RegisterNetEvent("coke:init", function()
icon = "fas fa-hand", icon = "fas fa-hand",
label = "pick cocaine", label = "pick cocaine",
action = function() action = function()
if not progressbar(Lang.Coke.picking, 4000, 'uncuff') then return end if not pick(k) then return end
TriggerServerEvent("coke:pickupCane", k) end
end
} }
}, },
distance = 2.5 distance = 2.5