- hush hush
This commit is contained in:
1 parent
4fdef3cf30
commit
a86a342f4d
17 files changed
+252
-432
No files matched your search
+1
-57
@@ -1,63 +1,7 @@
|
||||
local CocaPlant = {}
|
||||
|
||||
local cuttingcoke = 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
|
||||
|
||||
local function targetOps(loc)
|
||||
return {
|
||||
{
|
||||
icon = "fa-solid fa-seedling",
|
||||
label = ps.lang('targets.coke.pick'),
|
||||
action = function()
|
||||
if not pick(loc) then return end
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
RegisterNetEvent('coke:respawnCane', function(loc)
|
||||
local v = GlobalState.CocaPlant[loc]
|
||||
local hash = GetHashKey(v.model)
|
||||
if not CocaPlant[loc] then
|
||||
CocaPlant[loc] = CreateObject(hash, v.location, false, true, true)
|
||||
Freeze(CocaPlant[loc], true, v.heading)
|
||||
ps.entityTarget(CocaPlant[loc], targetOps(loc))
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('coke:removeCane', function(loc)
|
||||
if DoesEntityExist(CocaPlant[loc]) then DeleteEntity(CocaPlant[loc]) end
|
||||
CocaPlant[loc] = nil
|
||||
end)
|
||||
|
||||
RegisterNetEvent("coke:init", function()
|
||||
for k, v in pairs (GlobalState.CocaPlant) do
|
||||
local hash = GetHashKey(v.model)
|
||||
ps.requestModel(hash)
|
||||
if not v.taken then
|
||||
CocaPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
|
||||
Freeze(CocaPlant[k], true, v.heading)
|
||||
ps.entityTarget(CocaPlant[k], targetOps(k))
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
AddEventHandler('onResourceStop', function(resourceName)
|
||||
if GetCurrentResourceName() == resourceName then
|
||||
SetModelAsNoLongerNeeded(GetHashKey('prop_plant_01a'))
|
||||
for k, v in pairs(CocaPlant) do
|
||||
if DoesEntityExist(v) then
|
||||
DeleteEntity(v) SetEntityAsNoLongerNeeded(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
for k, v in pairs (GlobalState.MDDrugsLocs.MakePowder) do
|
||||
ps.boxTarget('cocaplant'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, {
|
||||
{
|
||||
|
||||
@@ -496,6 +496,7 @@ CreateThread(function()
|
||||
TriggerEvent('heroin:init')
|
||||
TriggerEvent('coke:init')
|
||||
TriggerEvent('Mescaline:init')
|
||||
ps.requestModel(GetHashKey('mushroom'))
|
||||
TriggerEvent('shrooms:init')
|
||||
TriggerEvent('weed:init')
|
||||
end)
|
||||
|
||||
+4
-59
@@ -1,22 +1,7 @@
|
||||
local PoppyPlants = {}
|
||||
|
||||
local herointable = false
|
||||
local dirty = false
|
||||
|
||||
local function pickher(loc)
|
||||
if not ps.progressbar(Lang.Heroin.pick, 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("heroin:pickupCane", loc)
|
||||
end
|
||||
|
||||
local function pickOps(loc)
|
||||
return {
|
||||
{
|
||||
icon = "fa-solid fa-seedling",
|
||||
label = ps.lang('Heroin.pick'),
|
||||
action = function() pickher(loc) end
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
local function createLabKit(coord, head)
|
||||
local heroinlabkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false,false)
|
||||
SetEntityHeading(heroinlabkit, head)
|
||||
@@ -31,6 +16,7 @@ local function createLabKit(coord, head)
|
||||
dirty = true
|
||||
TriggerServerEvent("md-drugs:server:failheatingheroin")
|
||||
ps.requestPTFX("core")
|
||||
lib.requestNamedPtfxAsset("core")
|
||||
local heroinkit = StartParticleFxLoopedOnEntity("exp_air_molotov", heroinlabkit, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false)
|
||||
SetParticleFxLoopedAlpha(heroinkit, 3.0)
|
||||
SetPedToRagdoll(PlayerPedId(), 1300, 1300, 0, 0, 0, 0)
|
||||
@@ -39,9 +25,8 @@ local function createLabKit(coord, head)
|
||||
TriggerServerEvent("md-drugs:server:heatliquidheroin")
|
||||
end,
|
||||
canInteract = function()
|
||||
if not dirty then return true end
|
||||
return false
|
||||
end
|
||||
if not dirty then return true end
|
||||
end
|
||||
},
|
||||
{
|
||||
icon = "fas fa-box-circle-check",
|
||||
@@ -74,46 +59,6 @@ local function createLabKit(coord, head)
|
||||
}})
|
||||
end
|
||||
|
||||
|
||||
|
||||
RegisterNetEvent('heroin:respawnCane', function(loc)
|
||||
local v = GlobalState.PoppyPlants[loc]
|
||||
local hash = GetHashKey(v.model)
|
||||
if not PoppyPlants[loc] then
|
||||
PoppyPlants[loc] = CreateObject(hash, v.location, false, true, true)
|
||||
Freeze(PoppyPlants[loc], true, v.heading)
|
||||
ps.entityTarget(PoppyPlants[loc], pickOps(loc), loc)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('heroin:removeCane', function(loc)
|
||||
if DoesEntityExist(PoppyPlants[loc]) then DeleteEntity(PoppyPlants[loc]) end
|
||||
PoppyPlants[loc] = nil
|
||||
end)
|
||||
|
||||
RegisterNetEvent("heroin:init", function()
|
||||
for k, v in pairs (GlobalState.PoppyPlants) do
|
||||
local hash = GetHashKey(v.model)
|
||||
if not HasModelLoaded(hash) then LoadModel(hash) end
|
||||
if not v.taken then
|
||||
PoppyPlants[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
|
||||
Freeze(PoppyPlants[k], true, v.heading)
|
||||
ps.entityTarget(PoppyPlants[k], pickOps(k))
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
AddEventHandler('onResourceStop', function(resourceName)
|
||||
if GetCurrentResourceName() == resourceName then
|
||||
SetModelAsNoLongerNeeded(GetHashKey('prop_plant_01b'))
|
||||
for k, v in pairs(PoppyPlants) do
|
||||
if DoesEntityExist(v) then
|
||||
DeleteEntity(v) SetEntityAsNoLongerNeeded(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
for k, v in pairs (GlobalState.MDDrugsLocs.dryplant) do
|
||||
ps.boxTarget('dryHeroin'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, {
|
||||
{
|
||||
|
||||
+23
-23
@@ -9,14 +9,14 @@ local function createLabKit(coord, head)
|
||||
local options = {
|
||||
{
|
||||
icon = "fa-solid fa-temperature-high",
|
||||
label = Lang.targets.lsd.heat,
|
||||
label = ps.lang('targets.lsd.heat'),
|
||||
action = function()
|
||||
local dict = "scr_ie_svm_technical2"
|
||||
if not ps.hasItems({
|
||||
{name = 'lysergic_acid', amount = 1},
|
||||
{name = 'diethylamide', amount = 1}
|
||||
}) then
|
||||
Notify(Lang.lsd.need, 'error')
|
||||
Notify(ps.lang('lsd.need'), 'error')
|
||||
return
|
||||
end
|
||||
if not minigame() then
|
||||
@@ -26,7 +26,7 @@ local function createLabKit(coord, head)
|
||||
SetParticleFxLoopedAlpha(exitPtfx, 3.0)
|
||||
return
|
||||
end
|
||||
if not progressbar(Lang.lsd.heat, 7000, 'uncuff') then return end
|
||||
if not progressbar(ps.lang('lsd.heat'), 7000, 'uncuff') then return end
|
||||
TriggerServerEvent("md-drugs:server:heatliquid")
|
||||
end,
|
||||
canInteract = function()
|
||||
@@ -35,11 +35,11 @@ local function createLabKit(coord, head)
|
||||
},
|
||||
{
|
||||
icon = "fa-solid fa-temperature-high",
|
||||
label = Lang.targets.lsd.refine,
|
||||
label = ps.lang('targets.lsd.refine'),
|
||||
action = function()
|
||||
if not ps.hasItem('lsd_one_vial') then return end
|
||||
if not minigame() then TriggerServerEvent("md-drugs:server:failrefinequality") return end
|
||||
if not ps.progressbar(Lang.lsd.refine, 4000, 'uncuff') then return end
|
||||
if not ps.progressbar(ps.lang('lsd.refine'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("md-drugs:server:refinequalityacid")
|
||||
end,
|
||||
canInteract = function()
|
||||
@@ -48,11 +48,11 @@ local function createLabKit(coord, head)
|
||||
},
|
||||
{
|
||||
icon = "fa-regular fa-note-sticky",
|
||||
label = Lang.targets.lsd.dab,
|
||||
label = ps.lang('targets.lsd.dab'),
|
||||
action = function()
|
||||
if not ps.hasItem('tab_paper') then return end
|
||||
if not minigame() then TriggerServerEvent("md-drugs:server:failtabs") return end
|
||||
if not ps.progressbar(Lang.lsd.dip, 4000, 'uncuff') then return end
|
||||
if not ps.progressbar(ps.lang('lsd.dip'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("md-drugs:server:maketabpaper")
|
||||
end,
|
||||
canInteract = function()
|
||||
@@ -62,9 +62,9 @@ local function createLabKit(coord, head)
|
||||
{
|
||||
event = "md-drugs:client:getlabkitback",
|
||||
icon = "fas fa-box-circle-check",
|
||||
label = Lang.targets.lsd.back,
|
||||
label = ps.lang('targets.lsd.back'),
|
||||
action = function()
|
||||
if not progressbar(Lang.lsd.tablepack, 4000, 'uncuff') then return end
|
||||
if not progressbar(ps.lang('lsd.tablepack'), 4000, 'uncuff') then return end
|
||||
DeleteObject(labkit)
|
||||
TriggerServerEvent('md-drugs:server:getlabkitback')
|
||||
tableout = false
|
||||
@@ -75,13 +75,13 @@ local function createLabKit(coord, head)
|
||||
},
|
||||
{
|
||||
icon = "fa-solid fa-hand-sparkles",
|
||||
label = Lang.targets.lsd.clean,
|
||||
label = ps.lang('targets.lsd.clean'),
|
||||
action = function()
|
||||
if not ps.hasItem('cleaningkit') then
|
||||
Notify(Lang.lsd.needclean, 'error')
|
||||
Notify(ps.lang('lsd.needclean'), 'error')
|
||||
return
|
||||
end
|
||||
if not ps.progressbar(Lang.lsd.clean, 4000, 'clean') then return end
|
||||
if not ps.progressbar(ps.lang('lsd.clean'), 4000, 'clean') then return end
|
||||
local check = ps.callback('md-drugs:server:removecleaningkit')
|
||||
if check then
|
||||
dirtylsd = false
|
||||
@@ -96,12 +96,12 @@ end
|
||||
for k, v in pairs (GlobalState.MDDrugsLocs.lysergicacid) do
|
||||
ps.boxTarget('lysergicacid'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, {
|
||||
{
|
||||
label = Lang.targets.lsd.lys,
|
||||
label = ps.lang('targets.lsd.lys'),
|
||||
icon = 'fa-solid fa-temperature-high',
|
||||
action = function()
|
||||
if not ps.hasItem('empty_weed_bag') then return end
|
||||
if not minigame() then TriggerServerEvent("md-drugs:server:faillysergic") return end
|
||||
if not ps.progressbar(Lang.lsd.steallys, 4000, 'uncuff') then return end
|
||||
if not ps.progressbar(ps.lang('lsd.steallys'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("md-drugs:server:getlysergic", k)
|
||||
end,
|
||||
canInteract = function()
|
||||
@@ -115,12 +115,12 @@ end
|
||||
for k, v in pairs (GlobalState.MDDrugsLocs.diethylamide) do
|
||||
ps.boxTarget('diethylamide'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, {
|
||||
{
|
||||
label = Lang.targets.lsd.die,
|
||||
label = ps.lang('targets.lsd.die'),
|
||||
icon = 'fa-solid fa-temperature-high',
|
||||
action = function()
|
||||
if not ps.hasItem('empty_weed_bag') then return end
|
||||
if not minigame() then TriggerServerEvent("md-drugs:server:faildiethylamide") return end
|
||||
if not ps.progressbar(Lang.lsd.stealdie, 4000, 'uncuff') then return end
|
||||
if not ps.progressbar(ps.lang('lsd.stealdie'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("md-drugs:server:getdiethylamide", k)
|
||||
end,
|
||||
canInteract = function()
|
||||
@@ -134,10 +134,10 @@ end
|
||||
for k,v in pairs (GlobalState.MDDrugsLocs.gettabs) do
|
||||
ps.boxTarget('gettabs'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, {
|
||||
{
|
||||
label = Lang.targets.lsd.buyt,
|
||||
label = ps.lang('targets.lsd.buyt'),
|
||||
icon = 'fa-solid fa-hand-holding-dollar',
|
||||
action = function()
|
||||
if not ps.hasItem('lsdlabkit') then ps.notify(Lang.lsd.havlabkit, 'error') return end
|
||||
if not ps.hasItem('lsdlabkit') then ps.notify(ps.lang('lsd.havlabkit'), 'error') return end
|
||||
TriggerEvent("md-drugs:client:buytabs", k)
|
||||
end,
|
||||
canInteract = function()
|
||||
@@ -151,11 +151,11 @@ end
|
||||
for k, v in pairs (GlobalState.MDDrugsLocs.buykit) do
|
||||
ps.boxTarget('buykit'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, {
|
||||
{
|
||||
label = Lang.targets.lsd.buy,
|
||||
label = ps.lang('targets.lsd.buy'),
|
||||
icon = 'fa-solid fa-hand-holding-dollar',
|
||||
action = function()
|
||||
if ps.hasItem('lsdlabkit') then ps.notify(Lang.lsd.havlabkit, 'error') return end
|
||||
if not ps.progressbar(Lang.lsd.buykit, 4000, 'uncuff') then return end
|
||||
if ps.hasItem('lsdlabkit') then ps.notify(ps.lang('lsd.havlabkit'), 'error') return end
|
||||
if not ps.progressbar(ps.lang('lsd.buykit'), 4000, 'uncuff') then return end
|
||||
TriggerEvent("md-drugs:client:buylabkit")
|
||||
end,
|
||||
canInteract = function()
|
||||
@@ -168,13 +168,13 @@ end
|
||||
|
||||
ps.registerCallback("md-drugs:client:setlsdlabkit", function()
|
||||
if tableout then
|
||||
Notify(Lang.lsd.tableout, 'error')
|
||||
Notify(ps.lang('lsd.tableout'), 'error')
|
||||
return false
|
||||
else
|
||||
tableout = true
|
||||
local loc, head = StartRay()
|
||||
if not loc then tableout = false return end
|
||||
if not progressbar(Lang.lsd.place, 4000, 'uncuff') then return end
|
||||
if not progressbar(ps.lang('lsd.place'), 4000, 'uncuff') then return end
|
||||
createLabKit(loc, head)
|
||||
return true, loc
|
||||
end
|
||||
|
||||
@@ -1,47 +1,4 @@
|
||||
local Mescaline = {}
|
||||
|
||||
local function pick(loc)
|
||||
if not progressbar(Lang.mescaline.pick, 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("Mescaline:pickupCane", loc)
|
||||
end
|
||||
|
||||
RegisterNetEvent('Mescaline:respawnCane', function(loc)
|
||||
local v = GlobalState.Mescaline[loc]
|
||||
local hash = GetHashKey(v.model)
|
||||
if not Mescaline[loc] then
|
||||
Mescaline[loc] = CreateObject(hash, v.location, false, true, true)
|
||||
Freeze(Mescaline[loc], true, v.heading)
|
||||
AddSingleModel(Mescaline[loc], {icon = "fa-solid fa-seedling",label = Lang.targets.mescaline.pick, action = function() pick(loc) end}, loc )
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('Mescaline:removeCane', function(loc)
|
||||
if DoesEntityExist(Mescaline[loc]) then DeleteEntity(Mescaline[loc]) end
|
||||
Mescaline[loc] = nil
|
||||
end)
|
||||
|
||||
RegisterNetEvent("Mescaline:init", function()
|
||||
for k, v in pairs (GlobalState.Mescaline) do
|
||||
local hash = GetHashKey(v.model)
|
||||
if not HasModelLoaded(hash) then LoadModel(hash) end
|
||||
if not v.taken then
|
||||
Mescaline[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
|
||||
Freeze(Mescaline[k], true, v.heading)
|
||||
AddSingleModel(Mescaline[k], {icon = "fa-solid fa-seedling",label = Lang.targets.mescaline.pick,action = function() pick(k) end}, k)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
AddEventHandler('onResourceStop', function(resourceName)
|
||||
if GetCurrentResourceName() == resourceName then
|
||||
SetModelAsNoLongerNeeded(GetHashKey('prop_cactus_03'))
|
||||
for k, v in pairs(Mescaline) do
|
||||
if DoesEntityExist(v) then
|
||||
DeleteEntity(v) SetEntityAsNoLongerNeeded(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent("md-drugs:client:drymescaline", function()
|
||||
if not ItemCheck('cactusbulb') then return end
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
|
||||
local DrugPlants = {
|
||||
{model = 'prop_plant_01a', label = 'coke', tbl = GlobalState.CocaPlant, plantTbl = {},
|
||||
pick = function(loc)
|
||||
if not ps.progressbar(ps.lang('Coke.picking'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("coke:pickupCane", loc)
|
||||
return true
|
||||
end,
|
||||
target = {
|
||||
icon = "fa-solid fa-seedling",
|
||||
label = ps.lang('targets.coke.pick'),
|
||||
},
|
||||
},
|
||||
{model = 'prop_plant_01b', label = 'heroin', tbl = GlobalState.PoppyPlants, plantTbl = {},
|
||||
pick = function(loc)
|
||||
if not ps.progressbar(ps.lang('Heroin.pick'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("heroin:pickupCane", loc)
|
||||
return true
|
||||
end,
|
||||
target = {
|
||||
icon = "fa-solid fa-seedling",
|
||||
label = ps.lang('targets.heroin.pick'),
|
||||
},
|
||||
},
|
||||
{model = 'prop_cactus_03', label = 'Mescaline', tbl = GlobalState.Mescaline, plantTbl = {},
|
||||
pick = function(loc)
|
||||
if not ps.progressbar(ps.lang('mescaline.pick'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("Mescaline:pickupCane", loc)
|
||||
return true
|
||||
end,
|
||||
target = {
|
||||
icon = "fa-solid fa-seedling",
|
||||
label = ps.lang('targets.mescaline.pick'),
|
||||
},
|
||||
},
|
||||
{model = 'prop_weed_01', label = 'weed', tbl = GlobalState.WeedPlant, plantTbl = {},
|
||||
pick = function(loc)
|
||||
if not ps.progressbar(ps.lang('Weed.picking'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("weed:pickupCane", loc)
|
||||
return true
|
||||
end,
|
||||
target = {
|
||||
icon = "fa-solid fa-seedling",
|
||||
label = ps.lang('targets.weed.pick'),
|
||||
},
|
||||
},
|
||||
{model = 'mushroom', label = 'shrooms', tbl = GlobalState.shrooms, plantTbl = {},
|
||||
pick = function(loc)
|
||||
if not ps.progressbar(ps.lang('Shrooms.pick'), 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("shrooms:pickupCane", loc)
|
||||
return true
|
||||
end,
|
||||
target = {
|
||||
icon = "fa-solid fa-hand",
|
||||
label = ps.lang('targets.shrooms.pick'),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for k, v in pairs (DrugPlants) do
|
||||
RegisterNetEvent(v.label ..':respawnCane', function(loc)
|
||||
local plant = v.tbl[loc]
|
||||
local hash = GetHashKey(plant.model)
|
||||
if not v.plantTbl[loc] then
|
||||
ps.requestModel(hash)
|
||||
v.plantTbl[loc] = CreateObject(hash, plant.location, false, true, true)
|
||||
Freeze(v.plantTbl[loc], true, plant.heading)
|
||||
ps.entityTarget(v.plantTbl[loc], {
|
||||
{
|
||||
icon = v.icon,
|
||||
label = v.label,
|
||||
action = function()
|
||||
if not v.pick(loc) then return end
|
||||
end
|
||||
}
|
||||
})
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent(v.label ..':removeCane', function(loc)
|
||||
ps.debug(v.plantTbl)
|
||||
DeleteEntity(v.plantTbl[loc])
|
||||
v.plantTbl[loc] = nil
|
||||
end)
|
||||
|
||||
RegisterNetEvent(v.label ..":init", function()
|
||||
if not v.plantTbl then v.plantTbl = {} end
|
||||
for key, value in pairs (v.tbl) do
|
||||
local hash = GetHashKey(value.model)
|
||||
if not value.taken then
|
||||
v.plantTbl[key] = CreateObject(hash, value.location.x, value.location.y, value.location.z, false, true, true)
|
||||
Freeze(v.plantTbl[key], true, v.heading)
|
||||
ps.entityTarget(v.plantTbl[key], {
|
||||
{
|
||||
icon = v.icon,
|
||||
label = v.label,
|
||||
action = function()
|
||||
if not v.pick(key) then return end
|
||||
end
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
AddEventHandler('onResourceStop', function(resourceName)
|
||||
if GetCurrentResourceName() == resourceName then
|
||||
SetModelAsNoLongerNeeded(GetHashKey('prop_plant_01a'))
|
||||
for k, v in pairs(DrugPlants) do
|
||||
for key, plant in pairs(v.plantTbl) do
|
||||
if DoesEntityExist(plant) then DeleteEntity(plant) end
|
||||
v.plantTbl[key] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -1,57 +1,3 @@
|
||||
local shrooms = {}
|
||||
|
||||
local function LoadModels(hash)
|
||||
hash = GetHashKey(hash)
|
||||
RequestModel(hash)
|
||||
local timeout = GetGameTimer() + 5000 -- 5-second timeout
|
||||
while not HasModelLoaded(hash) and GetGameTimer() < timeout do
|
||||
Wait(10)
|
||||
end
|
||||
if HasModelLoaded(hash) then return true end
|
||||
end
|
||||
|
||||
local function pick(loc)
|
||||
if not progressbar(Lang.Shrooms.pick, 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("shrooms:pickupCane", loc)
|
||||
end
|
||||
|
||||
RegisterNetEvent('shrooms:respawnCane', function(loc)
|
||||
local v = GlobalState.shrooms[loc]
|
||||
local hash = GetHashKey(v.model)
|
||||
if not shrooms[loc] then
|
||||
shrooms[loc] = CreateObject(hash, v.location, false, true, true)
|
||||
Freeze(shrooms[loc], true, v.heading)
|
||||
AddSingleModel(shrooms[loc],{ icon = "fas fa-hand", label = Lang.targets.shrooms.pick, action = function() pick(loc) end }, loc )
|
||||
end
|
||||
end)
|
||||
|
||||
AddEventHandler('onResourceStop', function(resourceName)
|
||||
if GetCurrentResourceName() == resourceName then
|
||||
SetModelAsNoLongerNeeded(GetHashKey('mushroom'))
|
||||
for k, v in pairs(shrooms) do
|
||||
if DoesEntityExist(v) then
|
||||
DeleteEntity(v) SetEntityAsNoLongerNeeded(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('shrooms:removeCane', function(loc)
|
||||
if DoesEntityExist(shrooms[loc]) then DeleteEntity(shrooms[loc]) end
|
||||
shrooms[loc] = nil
|
||||
end)
|
||||
|
||||
RegisterNetEvent("shrooms:init", function()
|
||||
for k, v in pairs (GlobalState.shrooms) do
|
||||
local hash = GetHashKey(v.model)
|
||||
if not HasModelLoaded(hash) then LoadModels(hash) end
|
||||
if not v.taken then
|
||||
shrooms[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true)
|
||||
Freeze(shrooms[k], true, v.heading)
|
||||
AddSingleModel(shrooms[k],{ icon = "fas fa-hand", label = Lang.targets.shrooms.pick, action = function() pick(k) end }, k )
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('md-drugs:client:takeshrooms', function()
|
||||
if not progressbar(Lang.Shrooms.eat, 500, 'eat') then return end
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
local WeedPlant = {}
|
||||
local exploded, drying = false, false
|
||||
|
||||
local function hasJob()
|
||||
@@ -9,49 +8,6 @@ local function hasJob()
|
||||
return true end
|
||||
end
|
||||
|
||||
local function pick(loc)
|
||||
if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end
|
||||
TriggerServerEvent("weed:pickupCane", loc)
|
||||
end
|
||||
|
||||
RegisterNetEvent('weed:respawnCane', function(loc)
|
||||
local v = GlobalState.WeedPlant[loc]
|
||||
local hash = GetHashKey(v.model)
|
||||
if not HasModelLoaded(hash) then LoadModel(hash) end
|
||||
if not WeedPlant[loc] then
|
||||
WeedPlant[loc] = CreateObject(hash, v.location.x, v.location.y, v.location.z-3.5, false, true, true)
|
||||
Freeze(WeedPlant[loc],true, v.heading)
|
||||
AddSingleModel(WeedPlant[loc], {icon = "fas fa-hand",label = Lang.targets.weed.pick, action = function() pick(loc) end}, loc)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('weed:removeCane', function(loc)
|
||||
if DoesEntityExist(WeedPlant[loc]) then DeleteEntity(WeedPlant[loc]) end
|
||||
WeedPlant[loc] = nil
|
||||
end)
|
||||
|
||||
RegisterNetEvent("weed:init", function()
|
||||
for k, v in pairs (GlobalState.WeedPlant) do
|
||||
local hash = GetHashKey(v.model)
|
||||
lib.requestModel('prop_weed_01', 1000)
|
||||
if not v.taken then
|
||||
WeedPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z-3.5, false, true, true)
|
||||
Freeze(WeedPlant[k],true, v.heading)
|
||||
AddSingleModel(WeedPlant[k], {icon = "fas fa-hand",label = Lang.targets.weed.pick, action = function() pick(k) end}, k)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
AddEventHandler('onResourceStop', function(resourceName)
|
||||
if GetCurrentResourceName() == resourceName then
|
||||
SetModelAsNoLongerNeeded(GetHashKey('bkr_prop_weed_lrg_01b'))
|
||||
for k, v in pairs(WeedPlant) do
|
||||
if DoesEntityExist(v) then
|
||||
DeleteEntity(v) SetEntityAsNoLongerNeeded(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
CreateThread(function()
|
||||
local config = ps.callback('md-drugs:server:getLocs', false)
|
||||
|
||||
Reference in new issue
Block a user