Update cocaine.lua

This commit is contained in:
Mustache Dom authored and GitHub committed 2024-09-17 13:01:17 -07:00
1 parent a8633c2884
commit 4db34e5f50
1 file changed
+45 -45
+45 -45
View File
@@ -1,13 +1,13 @@
local QBCore = exports['qb-core']:GetCoreObject() local QBCore = exports['qb-core']:GetCoreObject()
local CocaPlant = {} local CocaPlant = {}
local cuttingcoke = nil local cuttingcoke = nil
local baggingcoke = nil local baggingcoke = nil
local function pick(loc) local function pick(loc)
if not progressbar(Lang.Coke.picking, 4000, 'uncuff') then return end if not progressbar(Lang.Coke.picking, 4000, 'uncuff') then return end
TriggerServerEvent("coke:pickupCane", loc) TriggerServerEvent("coke:pickupCane", loc)
return true return true
end end
RegisterNetEvent('coke:respawnCane', function(loc) RegisterNetEvent('coke:respawnCane', function(loc)
local v = GlobalState.CocaPlant[loc] local v = GlobalState.CocaPlant[loc]
@@ -15,7 +15,7 @@ RegisterNetEvent('coke:respawnCane', function(loc)
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)
local options = { local options = {
{ {
icon = "fas fa-hand", icon = "fas fa-hand",
label = "pick Cocaine", label = "pick Cocaine",
@@ -24,20 +24,20 @@ RegisterNetEvent('coke:respawnCane', function(loc)
end end
} }
} }
local optionsox = { local optionsox = {
{ {
icon = "fas fa-hand", icon = "fas fa-hand",
label = "pick Cocaine", label = "pick Cocaine",
distance = 2.5, distance = 2.5,
onselect = function() onSelect = function()
if not pick(loc) then return end if not pick(loc) then return end
end end
} }
} }
if Config.oxtarget then if Config.oxtarget then
exports.ox_target:AddLocalEntity(CocaPlant[loc], optionsox) exports.ox_target:AddLocalEntity(CocaPlant[loc], optionsox)
else else
exports['qb-target']:AddTargetEntity(CocaPlant[loc], {options = options, distance = 2.5}) exports['qb-target']:addTargetEntity(CocaPlant[loc], {options = options, distance = 2.5})
end end
end end
end) end)
@@ -54,31 +54,31 @@ RegisterNetEvent("coke:init", function()
if not v.taken then if not v.taken then
CocaPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true) CocaPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
Freeze(CocaPlant[k], true, v.heading) Freeze(CocaPlant[k], true, v.heading)
local options = { local options = {
{ {
icon = "fas fa-hand", icon = "fas fa-hand",
label = "pick Cocaine", label = "pick Cocaine",
action = function() action = function()
if not pick(k) then return end if not pick(k) then return end
end end
} }
} }
local optionsox = { local optionsox = {
{ {
icon = "fas fa-hand", icon = "fas fa-hand",
label = "pick Cocaine", label = "pick Cocaine",
distance = 2.5, distance = 2.5,
onselect = function() onselect = function()
if not pick(k) then return end if not pick(k) then return end
end end
} }
} }
if Config.oxtarget then if Config.oxtarget then
exports.ox_target:AddLocalEntity(CocaPlant[k], optionsox) exports.ox_target:AddLocalEntity(CocaPlant[k], optionsox)
else else
exports['qb-target']:AddTargetEntity(CocaPlant[k], {options = options, distance = 2.5}) exports['qb-target']:AddTargetEntity(CocaPlant[k], {options = options, distance = 2.5})
end end
end end
end end
end) end)