From 94c64580372fe9d093458a7a7e5a7fab2beaf750 Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Wed, 16 Jul 2025 01:48:56 -0700 Subject: [PATCH] - update sv side plants --- client/animationsandfunctions.lua | 29 ++--- client/cornerselling.lua | 9 +- client/functions.lua | 148 +-------------------- client/lsd.lua | 12 +- client/plantSpawns.lua | 3 +- fxmanifest.lua | 1 + server/cocaine.lua | 44 ------- server/cornerselling.lua | 4 +- server/heroin.lua | 45 +------ server/mescaline.lua | 48 ------- server/plantSpawns.lua | 208 ++++++++++++++++++++++++++++++ server/shrooms.lua | 51 -------- server/weed.lua | 47 ------- 13 files changed, 239 insertions(+), 410 deletions(-) create mode 100644 server/plantSpawns.lua diff --git a/client/animationsandfunctions.lua b/client/animationsandfunctions.lua index 16b830a..dd1b94c 100644 --- a/client/animationsandfunctions.lua +++ b/client/animationsandfunctions.lua @@ -12,7 +12,7 @@ end function MethCooking() local animDict, animName = "anim@amb@business@meth@meth_monitoring_cooking@cooking@", "chemical_pour_short_cooker" - lib.requestAnimDict(animDict, 500) + ps.requestAnim(animDict, 500) SetEntityCoords(PlayerPedId(), vector3(1005.773, -3200.402, -38.524)) local targetPosition = GetEntityCoords(PlayerPedId()) local animDuration = GetAnimDuration(animDict, animName) * 800 @@ -29,7 +29,7 @@ function MethCooking() NetworkStopSynchronisedScene(netScene) DeleteObject(sacid) DeleteObject(ammonia) FreezeEntityPosition(PlayerPedId(), false) - lib.requestModel('hei_prop_heist_thermite', 2000) + ps.requestModel('hei_prop_heist_thermite', 2000) loadParticle('scr_ornate_heist') local thermite = CreateObject('hei_prop_heist_thermite', vector3(1005.76, -3201.3, -39.25), true, false, false) FreezeEntityPosition(thermite, true) @@ -44,7 +44,7 @@ end function SmashMeth() local ver = "" local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char02" - lib.requestAnimDict(animDict, 500) + ps.requestAnim(animDict, 500) local ped = PlayerPedId() local targetPosition = vector3(1012.628, -3194.619, -39.589) SetEntityCoords(ped, targetPosition) @@ -79,7 +79,7 @@ end function BagMeth() local ver = "" local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01" - lib.requestAnimDict(animDict, 500) + ps.requestAnim(animDict, 500) local animDuration = GetAnimDuration(animDict, animName) * 1000 local ped = PlayerPedId() local coords = GetEntityCoords(ped) @@ -161,7 +161,7 @@ end function CutCoke(coords, offset, rotation) local animDict, animName = "anim@amb@business@coc@coc_unpack_cut_left@", "coke_cut_v5_coccutter" - lib.requestAnimDict(animDict, 500) + ps.requestAnim(animDict, 500) local animDuration = GetAnimDuration(animDict, animName) * 1000 local ped = PlayerPedId() local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y,coords.z + offset.z), rotation @@ -216,7 +216,7 @@ end) function BagCoke(coords, offset, rotation) local ver = "" local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01" - lib.requestAnimDict(animDict, 500) + ps.requestAnim(animDict, 500) local animDuration = GetAnimDuration(animDict, animName) * 1000 local ped = PlayerPedId() local scenePos, sceneRot = vector3(coords.x + offset.x, coords.y + offset.y,coords.z + offset.z), rotation @@ -372,9 +372,9 @@ function SpawnCarPedChase() Notify(Lang.lean.act,'error') else started = true - lib.requestModel("pounder", Config.RequestModelTime) - lib.requestModel("ig_priest", Config.RequestModelTime) - lib.requestModel("cargobob3", Config.RequestModelTime) + ps.requestModel("pounder", Config.RequestModelTime) + ps.requestModel("ig_priest", Config.RequestModelTime) + ps.requestModel("cargobob3", Config.RequestModelTime) local leancar = CreateVehicle("pounder", start.x+3, start.y-2, start.z-1, 52.0, true, false) local driver = CreatePed(26, "ig_priest", start.x, start.y, start.z, 268.9422, false, false) local pilot2 = CreatePed(26, "ig_priest", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, false, false) @@ -418,12 +418,12 @@ local start = config.StartLoc[math.random(1,#config.StartLoc)] local startedmeth = false if startedmeth then - Notify(Lang.meth.act,'error') + ps.notify(Lang.meth.act,'error') else startedmeth = true - lib.requestModel("journey", Config.RequestModelTime) - lib.requestModel("a_m_m_hillbilly_02", Config.RequestModelTime) - lib.requestModel("cargobob3", Config.RequestModelTime) + ps.requestModel("journey", Config.RequestModelTime) + ps.requestModel("a_m_m_hillbilly_02", Config.RequestModelTime) + ps.requestModel("cargobob3", Config.RequestModelTime) local methcar = CreateVehicle("journey", start.x+3, start.y-2, start.z-1, 52.0, true, false) local methdriver = CreatePed(26, "a_m_m_hillbilly_02", start.x, start.y, start.z, 268.9422, false, false) local methpilot = CreatePed(26, "a_m_m_hillbilly_02", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, false, false) @@ -482,5 +482,4 @@ function SetUpPeds() TaskCombatPed(i, PlayerPedId(), 0, 16) SetPedCombatAttributes(i, 46, true) end -end - +end \ No newline at end of file diff --git a/client/cornerselling.lua b/client/cornerselling.lua index be59564..0f03a89 100644 --- a/client/cornerselling.lua +++ b/client/cornerselling.lua @@ -10,12 +10,12 @@ end local function sellDrug(item, amount, price, targ) -- PoliceCall(20) if ps.vehicleData() then - Notify(ps.lang('Cornerselling.inveh', 'error')) + ps.notify(ps.lang('Cornerselling.inveh', 'error')) walkAway(targ) return end - if not ps.progressbar(string.format(ps.lang('Cornerselling.selling', GetLabel(item), price)), 4000, 'uncuff') then walkAway(targ) return end + if not ps.progressbar(string.format(ps.lang('Cornerselling.selling', ps.getLabel(item), price)), 4000, 'uncuff') then walkAway(targ) return end buyers[targ] = 'sold' TriggerServerEvent('md-drugs:server:sellCornerDrugs', item, amount, price) walkAway(targ) @@ -46,6 +46,7 @@ local function findPed() until targ ~= nil buyers[targ] = true + ps.drawText('Waiting For Customer') repeat @@ -79,7 +80,7 @@ function Cornersell() if inZone then sell = false return end if not sell then - return + return end local hasDrugs = checkItems() @@ -123,7 +124,7 @@ function Cornersell() FreezeEntityPosition(targ, true) ps.entityTarget(data.ped, { { - label = string.format(ps.lang('targets.CornerSell.sell', data.amount, GetLabel(data.item), data.price)), + label = string.format(ps.lang('targets.CornerSell.sell', data.amount, ps.getLabel(data.item), data.price)), icon ="fa-solid fa-money-bill", action = function() sellDrug(data.item, data.amount, data.price, targ) diff --git a/client/functions.lua b/client/functions.lua index e604a32..e5dc6c0 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -1,65 +1,7 @@ -local QBCore = exports['qb-core']:GetCoreObject() -local progressbartype = Config.progressbartype local minigametype = Config.minigametype -local notifytype = Config.Notify local dispatch = Config.Dispatch -function getJobType() - return QBCore.Functions.GetPlayerData().job.type -end - -function getJobName() - return QBCore.Functions.GetPlayerData().job.name -end - -function progressbar(text, time, anim) - TriggerEvent('animations:client:EmoteCommandStart', {anim}) - if progressbartype == 'oxbar' then - if lib.progressBar({ duration = time, label = text, useWhileDead = false, canCancel = true, disable = { car = true, move = true},}) then - if GetResourceState('scully_emotemenu') == 'started' then - exports.scully_emotemenu:cancelEmote() - else - TriggerEvent('animations:client:EmoteCommandStart', {"c"}) - end - return true - end - elseif progressbartype == 'oxcir' then - if lib.progressCircle({ duration = time, label = text, useWhileDead = false, canCancel = true, position = 'bottom', disable = { car = true,move = true},}) then - if GetResourceState('scully_emotemenu') == 'started' then - exports.scully_emotemenu:cancelEmote() - else - TriggerEvent('animations:client:EmoteCommandStart', {"c"}) - end - return true - end - elseif progressbartype == 'qb' then - local test = false - local cancelled = false - QBCore.Functions.Progressbar("drink_something", text, time, false, true, { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, disableInventory = true, - }, {}, {}, {}, function()-- Done - test = true - if GetResourceState('scully_emotemenu') == 'started' then - exports.scully_emotemenu:cancelEmote() - else - TriggerEvent('animations:client:EmoteCommandStart', {"c"}) - end - end, function() - cancelled = true - if GetResourceState('scully_emotemenu') == 'started' then - exports.scully_emotemenu:cancelEmote() - else - TriggerEvent('animations:client:EmoteCommandStart', {"c"}) - end - end) - repeat - Wait(100) - until cancelled or test - if test then return true end - else - print"^1 SCRIPT ERROR: Md-DRUGS set your progressbar with one of the options!" - end - end function loadParticle(dict) if not HasNamedPtfxAssetLoaded(dict) then @@ -175,57 +117,7 @@ function minigame() else print"^1 SCRIPT ERROR: Md-Drugs set your minigame with one of the options!" end - end - - function Notify(text, type) - if notifytype =='ox' then - lib.notify({title = text, type = type}) - elseif notifytype == 'qb' then - QBCore.Functions.Notify(text, type) - elseif notifytype == 'okok' then - exports['okokNotify']:Alert('', text, 4000, type, false) - else - print"^1 SCRIPT ERROR: Md-DRUGS set your notification with one of the options!" - end - end - -function GetImage(img) - if GetResourceState('ox_inventory') == 'started' then - local Items = exports['ox_inventory']:Items() - if not Items[img] then print(' You Are Missing: ' .. img .. ' From Your ox items.lua') return end - local itemClient = Items[img] and Items[img]['client'] - if itemClient and itemClient['image'] then - return itemClient['image'] - else - return "nui://ox_inventory/web/images/" .. img .. '.png' - end - end - local invs = { - ['ps-inventory'] = "nui://ps-inventory/html/images/", - ['lj-inventory'] = "nui://lj-inventory/html/images/", - ['qb-inventory'] = "nui://qb-inventory/html/images/", - ['qs-inventory'] = "nui://qs-inventory/html/imgages/", - ['origen_inventory'] = "nui://origen_inventory/html/img/", - ['core_inventory'] = "nui://core_inventory/html/img/" - } - for k, v in pairs(invs) do - if not QBCore.Shared.Items[img] then print(' You Are Missing: ' .. img .. ' From Your QB items.lua') return end - if GetResourceState(k) == 'started' then - return v .. QBCore.Shared.Items[img].image - end - end -end - -function GetLabel(label) - if GetResourceState('ox_inventory') == 'started' then - local Items = exports['ox_inventory']:Items() - if not Items[label] then print(' You Are Missing: ' .. label .. ' From Your ox items.lua') return end - return Items[label]['label'] - else - if QBCore.Shared.Items[label] == nil then print("There Is No " .. label .. " In Your QB Items.lua") return end - return QBCore.Shared.Items[label]['label'] - end -end +end function GetRep() local rep = ps.callback('md-drugs:server:GetRep') @@ -269,43 +161,6 @@ function makeMenu(name, rep) end -function ItemCheck(item) - if GetResourceState('ox_inventory') == 'started' then - if exports.ox_inventory:GetItemCount(item) >= 1 then return true else Notify('You Need ' .. GetLabel(item) .. " !", 'error') return false end - else - if QBCore.Shared.Items[item] == nil then print("There Is No " .. item .. " In Your QB Items.lua") return end - if QBCore.Functions.HasItem(item) then return true else Notify('You Need ' .. QBCore.Shared.Items[item].label .. " !", 'error') return false end - end -end - -function hasItem(item) - if GetResourceState('ox_inventory') == 'started' then - if exports.ox_inventory:GetItemCount(item) >= 1 then return true else return false end - else - if QBCore.Shared.Items[item] == nil then print("There Is No " .. item .. " In Your QB Items.lua") return end - if QBCore.Functions.HasItem(item) then return true else return false end - end -end - -function ItemCheckMulti(item) - local need = 0 - local has = 0 - for k,v in pairs (item) do - need = need + 1 - if GetResourceState('ox_inventory') == 'started' then - if exports.ox_inventory:GetItemCount(v) >= 1 then has = has + 1 else Notify('You Need ' .. GetLabel(v) .. " !", 'error') end - else - if QBCore.Shared.Items[v] == nil then print("There Is No " .. item .. " In Your QB Items.lua") return end - if QBCore.Functions.HasItem(v) then has = has + 1 else Notify('You Need ' .. QBCore.Shared.Items[v].label .. " !", 'error') end - end - end - if need == has then - return true - else - return false - end -end - function Email(sender, subject, message) if Config.Phone == 'yflip' then local receiver = GetPlayerServerId(PlayerId()) @@ -498,7 +353,6 @@ CreateThread(function() TriggerEvent('Mescaline:init') ps.requestModel(GetHashKey('mushroom')) TriggerEvent('shrooms:init') - TriggerEvent('weed:init') end) ps.registerCallback('md-drugs:client:uncuff', function(data) diff --git a/client/lsd.lua b/client/lsd.lua index 906f289..ff1687f 100644 --- a/client/lsd.lua +++ b/client/lsd.lua @@ -16,7 +16,7 @@ local function createLabKit(coord, head) {name = 'lysergic_acid', amount = 1}, {name = 'diethylamide', amount = 1} }) then - Notify(ps.lang('lsd.need'), 'error') + ps.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(ps.lang('lsd.heat'), 7000, 'uncuff') then return end + if not ps.progressbar(ps.lang('lsd.heat'), 7000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:heatliquid") end, canInteract = function() @@ -64,7 +64,7 @@ local function createLabKit(coord, head) icon = "fas fa-box-circle-check", label = ps.lang('targets.lsd.back'), action = function() - if not progressbar(ps.lang('lsd.tablepack'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('lsd.tablepack'), 4000, 'uncuff') then return end DeleteObject(labkit) TriggerServerEvent('md-drugs:server:getlabkitback') tableout = false @@ -78,7 +78,7 @@ local function createLabKit(coord, head) label = ps.lang('targets.lsd.clean'), action = function() if not ps.hasItem('cleaningkit') then - Notify(ps.lang('lsd.needclean'), 'error') + ps.notify(ps.lang('lsd.needclean'), 'error') return end if not ps.progressbar(ps.lang('lsd.clean'), 4000, 'clean') then return end @@ -168,13 +168,13 @@ end ps.registerCallback("md-drugs:client:setlsdlabkit", function() if tableout then - Notify(ps.lang('lsd.tableout'), 'error') + ps.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(ps.lang('lsd.place'), 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('lsd.place'), 4000, 'uncuff') then return end createLabKit(loc, head) return true, loc end diff --git a/client/plantSpawns.lua b/client/plantSpawns.lua index 0149a0a..104e61d 100644 --- a/client/plantSpawns.lua +++ b/client/plantSpawns.lua @@ -10,7 +10,7 @@ local DrugPlants = { icon = "fa-solid fa-seedling", label = ps.lang('targets.coke.pick'), }, - allow = Config.Drugs.coke, + allow = Config.Drugs.cocaine, }, {model = 'prop_plant_01b', label = 'heroin', tbl = GlobalState.PoppyPlants, plantTbl = {}, pick = function(loc) @@ -85,7 +85,6 @@ for k, v in pairs (DrugPlants) do end) RegisterNetEvent(v.label ..':removeCane', function(loc) - ps.debug(v.plantTbl) DeleteEntity(v.plantTbl[loc]) v.plantTbl[loc] = nil end) diff --git a/fxmanifest.lua b/fxmanifest.lua index dcb31de..8c85ffe 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -15,6 +15,7 @@ server_scripts { 'server/functions.lua', 'server/locations.lua', 'server/recipes.lua', + 'server/plantSpawns.lua', 'serverRun.lua', '@oxmysql/lib/MySQL.lua', } diff --git a/server/cocaine.lua b/server/cocaine.lua index 65cbd8b..746fdaa 100644 --- a/server/cocaine.lua +++ b/server/cocaine.lua @@ -1,48 +1,4 @@ -local cokeplants = { - { location = vector3(1474.25, -2643.87, 42.88), heading = 334.49, model = "prop_plant_01a", taken = false }, - { location = vector3(1472.35, -2649.3, 41.87), heading = 329.56, model = "prop_plant_01a", taken = false }, - { location = vector3(1475.7, -2652.9, 40.8), heading = 25.16, model = "prop_plant_01a", taken = false }, - { location = vector3(1481.0, -2654.99, 39.86), heading = 21.52, model = "prop_plant_01a", taken = false }, - { location = vector3(1480.9, -2660.63, 38.68), heading = 202.97, model = "prop_plant_01a", taken = false }, - { location = vector3(1477.18, -2666.53, 38.19), heading = 202.97, model = "prop_plant_01a", taken = false }, - { location = vector3(1477.58, -2670.82, 37.73), heading = 202.97, model = "prop_plant_01a", taken = false }, - { location = vector3(1476.56, -2675.82, 37.46), heading = 202.97, model = "prop_plant_01a", taken = false }, - { location = vector3(1474.8, -2680.19, 37.03), heading = 202.97, model = "prop_plant_01a", taken = false }, - { location = vector3(1471.52, -2685.0, 36.82), heading = 202.97, model = "prop_plant_01a", taken = false }, - { location = vector3(1462.82, -2676.58, 38.83), heading = 202.97, model = "prop_plant_01a", taken = false }, - { location = vector3(1461.31, -2667.74, 39.67), heading = 202.97, model = "prop_plant_01a", taken = false }, - { location = vector3(1456.3, -2647.61, 43.39), heading = 202.97, model = "prop_plant_01a", taken = false }, - { location = vector3(1453.65, -2641.56, 45.0), heading = 202.97, model = "prop_plant_01a", taken = false }, -} - -GlobalState.CocaPlant = cokeplants - - -function CaneCooldown(loc) - CreateThread(function() - Wait(Config.respawnTime * 1000) - cokeplants[loc].taken = false - GlobalState.CocaPlant = cokeplants - Wait(1000) - TriggerClientEvent('coke:respawnCane', -1, loc) - Log('Coca Plant Respawned At ' .. cokeplants[loc].location, 'coke') - end) -end - -RegisterNetEvent("coke:pickupCane") -AddEventHandler("coke:pickupCane", function(loc) - local src = source - if CheckDist(src, cokeplants[loc].location) then return end - if not cokeplants[loc].taken then - cokeplants[loc].taken = true - GlobalState.CocaPlant = cokeplants - TriggerClientEvent("coke:removeCane", -1, loc) - CaneCooldown(loc) - ps.addItem(src, 'coca_leaf', 1) - end -end) - RegisterServerEvent('md-drugs:server:makepowder', function(num) local src = source if not ps.checkDistance(src, GlobalState.MDDrugsLocs.MakePowder[num].loc, 3.5) then diff --git a/server/cornerselling.lua b/server/cornerselling.lua index 4dfa634..2c01dba 100644 --- a/server/cornerselling.lua +++ b/server/cornerselling.lua @@ -126,6 +126,7 @@ for k, v in pairs(Drugs) do table.insert(drugsNames, k) end GlobalState.DrugNames = drugsNames + local robChance = 1 -- Chance To Be Robbed local RobbedDrugs = {} @@ -211,11 +212,10 @@ RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price DrugDeals[ps.getIdentifier(src)] = nil return end - --AddRep(src, 'cornerselling', Drugs[item].rep * amount) + AddRep(src, 'cornerselling', Drugs[item].rep * amount) Log(string.format('%s Sold %s Of %s For A Price Of $%s !', GetName(src),amount, item, price), 'cornerselling') DrugDeals[ps.getIdentifier(src)] = nil ps.addMoney(src, 'cash', price) - end) RegisterNetEvent('md-drugs:server:getBackRobbed', function() diff --git a/server/heroin.lua b/server/heroin.lua index deecfc3..79481c0 100644 --- a/server/heroin.lua +++ b/server/heroin.lua @@ -2,39 +2,6 @@ local heroinLabKits = {} local prices = { heroinlabkitprice = 10000 } -local h = { - { location = vector3(-2251.3, -99.18, 100.11), heading = 334.49, model = "prop_plant_01b"}, - { location = vector3(-2249.63, -92.97, 101.8), heading = 329.56, model = "prop_plant_01b"}, - { location = vector3(-2245.57, -85.12, 104.5), heading = 25.16, model = "prop_plant_01b"}, - { location = vector3(-2240.81, -88.48, 105.88), heading = 21.52, model = "prop_plant_01b"}, - { location = vector3(-2240.87, -93.36, 103.88), heading = 334.49, model = "prop_plant_01b"}, - { location = vector3(-2236.0, -95.34, 102.55), heading = 329.56, model = "prop_plant_01b"}, - { location = vector3(-2240.6, -100.01, 100.49), heading = 25.16, model = "prop_plant_01b"}, - { location = vector3(-2246.29, -104.92, 99.27), heading = 21.52, model = "prop_plant_01b"}, - { location = vector3(-2243.64, -107.99, 96.71), heading = 334.49, model = "prop_plant_01b"}, - { location = vector3(-2254.22, -108.76, 97.25), heading = 329.56, model = "prop_plant_01b"}, - { location = vector3(-2247.33, -108.92, 97.70), heading = 25.16, model = "prop_plant_01b"}, - { location = vector3(-2250.96, -111.22, 97.50), heading = 21.52, model = "prop_plant_01b"}, - { location = vector3(465.95, -1021.32, 31.78), heading = 21.52, model = "prop_plant_01b"}, -} - -GlobalState.PoppyPlants = h -Citizen.CreateThread(function() - for _, v in pairs(h) do - v.taken = false - end -end) - -function heroinCooldown(loc) - CreateThread(function() - Wait(Config.respawnTime * 1000) - h[loc].taken = false - GlobalState.PoppyPlants = h - Wait(1000) - TriggerClientEvent('heroin:respawnCane', -1, loc) - Log('Heroin Plant Respawned At ' .. h[loc].location, 'heroin') - end) -end ps.registerCallback('removeCleaningkit', function(source) for k, v in pairs(heroinLabKits) do @@ -46,17 +13,7 @@ ps.registerCallback('removeCleaningkit', function(source) return false end) -RegisterServerEvent("heroin:pickupCane", function(loc) - local src = source - if not ps.checkDistance(src, h[loc].location, 3.0) then return end - if not h[loc].taken then - h[loc].taken = true - GlobalState.PoppyPlants = h - TriggerClientEvent("heroin:removeCane", -1, loc) - heroinCooldown(loc) - ps.addItem(src, 'poppyresin', 1) - end -end) + RegisterServerEvent('md-drugs:server:dryplant', function(num) local src = source diff --git a/server/mescaline.lua b/server/mescaline.lua index bc07e14..fc85a5a 100644 --- a/server/mescaline.lua +++ b/server/mescaline.lua @@ -1,53 +1,5 @@ -local m = { - { location = vector3(2598.73, 4207.89, 41.02), heading = 334.49, model = "prop_cactus_03"}, - { location = vector3(2601.46, 4199.34, 40.62), heading = 329.56, model = "prop_cactus_03"}, - { location = vector3(2611.63, 4194.18, 41.18), heading = 25.16, model = "prop_cactus_03"}, - { location = vector3(2620.18, 4202.69, 41.5), heading = 21.52, model = "prop_cactus_03"}, - { location = vector3(2624.26, 4211.75, 42.34), heading = 334.49, model = "prop_cactus_03"}, - { location = vector3(2635.21, 4207.5, 42.49), heading = 329.56, model = "prop_cactus_03"}, - { location = vector3(2644.97, 4193.51, 42.11), heading = 25.16, model = "prop_cactus_03"}, - { location = vector3(2654.21, 4195.31, 41.23), heading = 21.52, model = "prop_cactus_03"}, - { location = vector3(2653.32, 4206.49, 41.62), heading = 334.49, model = "prop_cactus_03"}, - { location = vector3(2647.45, 4213.94, 42.49), heading = 329.56, model = "prop_cactus_03"}, - { location = vector3(2636.3, 4218.49, 43.03), heading = 25.16, model = "prop_cactus_03"}, - { location = vector3(2627.37, 4223.2, 42.88), heading = 21.52, model = "prop_cactus_03"}, - { location = vector3(2617.86, 4230.38, 42.63), heading = 21.52, model = "prop_cactus_03"}, - { location = vector3(2609.8, 4222.12, 41.19), heading = 21.52, model = "prop_cactus_03"}, - { location = vector3(2602.96, 4194.05, 41.01), heading = 21.52, model = "prop_cactus_03"}, - { location = vector3(2614.39, 4188.3, 41.68), heading = 21.52, model = "prop_cactus_03"}, - { location = vector3(2623.82, 4189.97, 41.44), heading = 21.52, model = "prop_cactus_03"}, -} -GlobalState.Mescaline = m -Citizen.CreateThread(function() - for _, v in pairs(m) do - v.taken = false - end -end) - -function MescalineCooldown(loc) - CreateThread(function() - Wait(Config.respawnTime * 1000) - m[loc].taken = false - GlobalState.Mescaline = m - TriggerClientEvent('Mescaline:respawnCane', -1, loc) - Log('Cactus Respawned At ' ..m[loc].location, 'mescaline') - end) -end - - -RegisterNetEvent("Mescaline:pickupCane", function(loc) - if CheckDist(source, m[loc].location) then return end - if not m[loc].taken then - m[loc].taken = true - GlobalState.Mescaline = m - TriggerClientEvent("Mescaline:removeCane", -1, loc) - MescalineCooldown(loc) - ps.addItem(source,'cactusbulb', 1) - end -end) - RegisterNetEvent("md-drugs:server:drymescaline", function() local src = source if not checkLoc(src, 'singleSpot', 'DryOut') then return end diff --git a/server/plantSpawns.lua b/server/plantSpawns.lua new file mode 100644 index 0000000..a25408b --- /dev/null +++ b/server/plantSpawns.lua @@ -0,0 +1,208 @@ +local plants = { + cocaine = { + { location = vector3(1474.25, -2643.87, 42.88), heading = 334.49, model = "prop_plant_01a", taken = false }, + { location = vector3(1472.35, -2649.3, 41.87), heading = 329.56, model = "prop_plant_01a", taken = false }, + { location = vector3(1475.7, -2652.9, 40.8), heading = 25.16, model = "prop_plant_01a", taken = false }, + { location = vector3(1481.0, -2654.99, 39.86), heading = 21.52, model = "prop_plant_01a", taken = false }, + { location = vector3(1480.9, -2660.63, 38.68), heading = 202.97, model = "prop_plant_01a", taken = false }, + { location = vector3(1477.18, -2666.53, 38.19), heading = 202.97, model = "prop_plant_01a", taken = false }, + { location = vector3(1477.58, -2670.82, 37.73), heading = 202.97, model = "prop_plant_01a", taken = false }, + { location = vector3(1476.56, -2675.82, 37.46), heading = 202.97, model = "prop_plant_01a", taken = false }, + { location = vector3(1474.8, -2680.19, 37.03), heading = 202.97, model = "prop_plant_01a", taken = false }, + { location = vector3(1471.52, -2685.0, 36.82), heading = 202.97, model = "prop_plant_01a", taken = false }, + { location = vector3(1462.82, -2676.58, 38.83), heading = 202.97, model = "prop_plant_01a", taken = false }, + { location = vector3(1461.31, -2667.74, 39.67), heading = 202.97, model = "prop_plant_01a", taken = false }, + { location = vector3(1456.3, -2647.61, 43.39), heading = 202.97, model = "prop_plant_01a", taken = false }, + { location = vector3(1453.65, -2641.56, 45.0), heading = 202.97, model = "prop_plant_01a", taken = false }, + }, + heroin = { + { location = vector3(-2251.3, -99.18, 100.11), heading = 334.49, model = "prop_plant_01b", taken = false}, + { location = vector3(-2249.63, -92.97, 101.8), heading = 329.56, model = "prop_plant_01b", taken = false}, + { location = vector3(-2245.57, -85.12, 104.5), heading = 25.16, model = "prop_plant_01b", taken = false}, + { location = vector3(-2240.81, -88.48, 105.88), heading = 21.52, model = "prop_plant_01b", taken = false}, + { location = vector3(-2240.87, -93.36, 103.88), heading = 334.49, model = "prop_plant_01b", taken = false}, + { location = vector3(-2236.0, -95.34, 102.55), heading = 329.56, model = "prop_plant_01b", taken = false}, + { location = vector3(-2240.6, -100.01, 100.49), heading = 25.16, model = "prop_plant_01b", taken = false}, + { location = vector3(-2246.29, -104.92, 99.27), heading = 21.52, model = "prop_plant_01b", taken = false}, + { location = vector3(-2243.64, -107.99, 96.71), heading = 334.49, model = "prop_plant_01b", taken = false}, + { location = vector3(-2254.22, -108.76, 97.25), heading = 329.56, model = "prop_plant_01b", taken = false}, + { location = vector3(-2247.33, -108.92, 97.70), heading = 25.16, model = "prop_plant_01b", taken = false}, + { location = vector3(-2250.96, -111.22, 97.50), heading = 21.52, model = "prop_plant_01b", taken = false}, + { location = vector3(465.95, -1021.32, 31.78), heading = 21.52, model = "prop_plant_01b", taken = false}, + }, + mescaline = { + { location = vector3(2598.73, 4207.89, 41.02), heading = 334.49, model = "prop_cactus_03", taken = false}, + { location = vector3(2601.46, 4199.34, 40.62), heading = 329.56, model = "prop_cactus_03", taken = false}, + { location = vector3(2611.63, 4194.18, 41.18), heading = 25.16, model = "prop_cactus_03", taken = false}, + { location = vector3(2620.18, 4202.69, 41.5), heading = 21.52, model = "prop_cactus_03", taken = false}, + { location = vector3(2624.26, 4211.75, 42.34), heading = 334.49, model = "prop_cactus_03", taken = false}, + { location = vector3(2635.21, 4207.5, 42.49), heading = 329.56, model = "prop_cactus_03", taken = false}, + { location = vector3(2644.97, 4193.51, 42.11), heading = 25.16, model = "prop_cactus_03", taken = false}, + { location = vector3(2654.21, 4195.31, 41.23), heading = 21.52, model = "prop_cactus_03", taken = false}, + { location = vector3(2653.32, 4206.49, 41.62), heading = 334.49, model = "prop_cactus_03", taken = false}, + { location = vector3(2647.45, 4213.94, 42.49), heading = 329.56, model = "prop_cactus_03", taken = false}, + { location = vector3(2636.3, 4218.49, 43.03), heading = 25.16, model = "prop_cactus_03", taken = false}, + { location = vector3(2627.37, 4223.2, 42.88), heading = 21.52, model = "prop_cactus_03", taken = false}, + { location = vector3(2617.86, 4230.38, 42.63), heading = 21.52, model = "prop_cactus_03", taken = false}, + { location = vector3(2609.8, 4222.12, 41.19), heading = 21.52, model = "prop_cactus_03", taken = false}, + { location = vector3(2602.96, 4194.05, 41.01), heading = 21.52, model = "prop_cactus_03", taken = false}, + { location = vector3(2614.39, 4188.3, 41.68), heading = 21.52, model = "prop_cactus_03", taken = false}, + { location = vector3(2623.82, 4189.97, 41.44), heading = 21.52, model = "prop_cactus_03", taken = false}, + }, + shrooms = { + { location = vector3(2185.14, 5183.81, 57.48), heading = 334.49, model = "mushroom", taken = false}, + { location = vector3(2174.45, 5187.85, 57.43), heading = 329.56, model = "mushroom", taken = false}, + { location = vector3(2166.22, 5196.56, 58.0), heading = 25.16, model = "mushroom", taken = false}, + { location = vector3(2166.82, 5204.83, 58.63), heading = 21.52, model = "mushroom", taken = false}, + { location = vector3(2174.84, 5205.82, 59.19), heading = 334.49, model = "mushroom", taken = false}, + { location = vector3(2184.46, 5201.23, 59.2), heading = 329.56, model = "mushroom", taken = false}, + { location = vector3(2192.45, 5194.89, 58.86), heading = 25.16, model = "mushroom", taken = false}, + { location = vector3(2207.53, 5187.81, 58.95), heading = 21.52, model = "mushroom", taken = false}, + { location = vector3(2213.46, 5191.11, 59.81), heading = 334.49, model = "mushroom", taken = false}, + { location = vector3(2218.31, 5180.0, 58.18), heading = 329.56, model = "mushroom", taken = false}, + { location = vector3(2212.75, 5172.35, 57.2), heading = 25.16, model = "mushroom", taken = false}, + { location = vector3(2208.56, 5167.06, 56.34), heading = 21.52, model = "mushroom", taken = false}, + { location = vector3(2196.9, 5158.59, 54.84), heading = 21.52, model = "mushroom", taken = false}, + { location = vector3(2191.62, 5174.91, 56.68), heading = 21.52, model = "mushroom", taken = false}, + { location = vector3(2190.18, 5182.54, 57.47), heading = 21.52, model = "mushroom", taken = false}, + { location = vector3(2185.85, 5190.49, 58.1), heading = 21.52, model = "mushroom", taken = false}, + { location = vector3(2179.95, 5194.19, 58.26), heading = 21.52, model = "mushroom", taken = false}, + }, + weed = { + { location = vector3(1064.84, -3199.84, -42.70), heading = 334.49, model = "bkr_prop_weed_lrg_01b", taken = false}, + { location = vector3(1063.88, -3198.69, -42.70), heading = 329.56, model = "bkr_prop_weed_lrg_01b", taken = false}, + { location = vector3(1061.68, -3196.46, -42.70), heading = 25.16, model = "bkr_prop_weed_lrg_01b", taken = false}, + { location = vector3(1061.62, -3199.63, -42.70), heading = 21.52, model = "bkr_prop_weed_lrg_01b", taken = false}, + { location = vector3(1062.82, -3197.70, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b", taken = false}, + { location = vector3(1064.69, -3196.31, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b", taken = false}, + { location = vector3(1062.92, -3198.78, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b", taken = false}, + { location = vector3(1049.73, -3201.92, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b", taken = false}, + { location = vector3(1052.94, -3202.21, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b", taken = false}, + { location = vector3(1051.93, -3201.17, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b", taken = false}, + { location = vector3(1050.98, -3201.13, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b", taken = false}, + { location = vector3(1050.89, -3200.07, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b", taken = false}, + { location = vector3(1050.89, -3198.95, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b", taken = false}, + { location = vector3(1049.72, -3198.95, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b", taken = false}, + } +} + +local plantData = { + { + label = 'coke', + plants = plants.cocaine, + globalState = function() + GlobalState.CocaPlant = plants.cocaine + end, + itemGive = function(src) + ps.addItem(src, 'coca_leaf', 1) + end, + coolDown = function(loc) + CreateThread(function() + Wait(Config.respawnTime * 1000) + plants.cocaine[loc].taken = false + GlobalState.CocaPlant = plants.cocaine + TriggerClientEvent('coke:respawnCane', -1, loc) + Log('Coca Plant Respawned At ' .. plants.cocaine[loc].location, 'coke') + end) + end, + allow = Config.Drugs.cocaine + }, + { + label = 'heroin', + plants = plants.heroin, + globalState = function() + GlobalState.PoppyPlants = plants.heroin + end, + itemGive = function(src) + ps.addItem(src, 'poppyresin', 1) + end, + coolDown = function(loc) + CreateThread(function() + Wait(Config.respawnTime * 1000) + plants.heroin[loc].taken = false + GlobalState.PoppyPlants = plants.heroin + TriggerClientEvent('heroin:respawnCane', -1, loc) + Log('Heroin Plant Respawned At ' .. plants.heroin[loc].location, 'heroin') + end) + end, + allow = Config.Drugs.heroin + }, + { + label = 'Mescaline', + plants = plants.mescaline, + globalState = function() + GlobalState.Mescaline = plants.mescaline + end, + itemGive = function(src) + ps.addItem(src, 'cactusbulb', 1) + end, + coolDown = function(loc) + CreateThread(function() + Wait(Config.respawnTime * 1000) + plants.mescaline[loc].taken = false + GlobalState.Mescaline = plants.mescaline + TriggerClientEvent('Mescaline:respawnCane', -1, loc) + Log('Mescaline Plant Respawned At ' .. plants.mescaline[loc].location, 'mescaline') + end) + end, + allow = Config.Drugs.mescaline + }, + { + label = 'shrooms', + plants = plants.shrooms, + globalState = function() + GlobalState.shrooms = plants.shrooms + end, + itemGive = function(src) + ps.addItem(src, 'shrooms', 1) + end, + coolDown = function(loc) + CreateThread(function() + Wait(Config.respawnTime * 1000) + plants.shrooms[loc].taken = false + GlobalState.shrooms = plants.shrooms + TriggerClientEvent('shrooms:respawnCane', -1, loc) + Log('Shroom Respawned At ' .. plants.shrooms[loc].location, 'shrooms') + end) + end, + allow = Config.Drugs.shrooms + }, + { + label = 'weed', + plants = plants.weed, + globalState = function() + GlobalState.WeedPlant = plants.weed + end, + itemGive = function(src) + ps.addItem(src, 'wetcannabis', 1) + end, + coolDown = function(loc) + CreateThread(function() + Wait(Config.respawnTime * 1000) + plants.weed[loc].taken = false + GlobalState.WeedPlant = plants.weed + TriggerClientEvent('weed:respawnCane', -1, loc) + Log('Weed Plant Respawned At ' .. plants.weed[loc].location, 'weed') + end) + end, + allow = Config.Drugs.weed + } +} + +for k, v in pairs (plantData) do + if not v.allow then goto continue end + v.globalState() + RegisterNetEvent(v.label ..":pickupCane", function(loc) + local src = source + if ps.checkDistance(src, v.plants[loc].location, 5.0) then + if not v.plants[loc].taken then + v.plants[loc].taken = true + v.globalState() + TriggerClientEvent(v.label ..":removeCane", -1, loc) + v.coolDown(loc) + v.itemGive(src) + end + end + end) + ::continue:: +end \ No newline at end of file diff --git a/server/shrooms.lua b/server/shrooms.lua index 61f0be1..621bd70 100644 --- a/server/shrooms.lua +++ b/server/shrooms.lua @@ -1,54 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() - -local s = { - { location = vector3(2185.14, 5183.81, 57.48), heading = 334.49, model = "mushroom"}, - { location = vector3(2174.45, 5187.85, 57.43), heading = 329.56, model = "mushroom"}, - { location = vector3(2166.22, 5196.56, 58.0), heading = 25.16, model = "mushroom"}, - { location = vector3(2166.82, 5204.83, 58.63), heading = 21.52, model = "mushroom"}, - { location = vector3(2174.84, 5205.82, 59.19), heading = 334.49, model = "mushroom"}, - { location = vector3(2184.46, 5201.23, 59.2), heading = 329.56, model = "mushroom"}, - { location = vector3(2192.45, 5194.89, 58.86), heading = 25.16, model = "mushroom"}, - { location = vector3(2207.53, 5187.81, 58.95), heading = 21.52, model = "mushroom"}, - { location = vector3(2213.46, 5191.11, 59.81), heading = 334.49, model = "mushroom"}, - { location = vector3(2218.31, 5180.0, 58.18), heading = 329.56, model = "mushroom"}, - { location = vector3(2212.75, 5172.35, 57.2), heading = 25.16, model = "mushroom"}, - { location = vector3(2208.56, 5167.06, 56.34), heading = 21.52, model = "mushroom"}, - { location = vector3(2196.9, 5158.59, 54.84), heading = 21.52, model = "mushroom"}, - { location = vector3(2191.62, 5174.91, 56.68), heading = 21.52, model = "mushroom"}, - { location = vector3(2190.18, 5182.54, 57.47), heading = 21.52, model = "mushroom"}, - { location = vector3(2185.85, 5190.49, 58.1), heading = 21.52, model = "mushroom"}, - { location = vector3(2179.95, 5194.19, 58.26), heading = 21.52, model = "mushroom"}, -} -GlobalState.shrooms = s -Citizen.CreateThread(function() - for _, v in pairs(s) do - v.taken = false - end -end) - - -function shroomsCooldown(loc) - CreateThread(function() - Wait(Config.respawnTime * 1000) - s[loc].taken = false - GlobalState.shrooms = s - Wait(1000) - TriggerClientEvent('shrooms:respawnCane', -1, loc) - Log('Cactus Respawned At ' .. s[loc].location, 'shrooms') - end) -end - -RegisterNetEvent("shrooms:pickupCane", function(loc) - if CheckDist(source, s[loc].location) then return end - if not s[loc].taken then - s[loc].taken = true - GlobalState.shrooms = s - TriggerClientEvent("shrooms:removeCane", -1, loc) - shroomsCooldown(loc) - ps.addItem(source, 'shrooms', 1) - Log(GetName(source) .. ' Picked A Shroom With a distance of ' .. dist(source,s[loc].location) .. ' vectors', 'shrooms') - end -end) CUI('shrooms', function(source, item) local src = source diff --git a/server/weed.lua b/server/weed.lua index cdb8c8c..9ecdf3d 100644 --- a/server/weed.lua +++ b/server/weed.lua @@ -1,52 +1,5 @@ -local QBCore = exports['qb-core']:GetCoreObject() -local weedPlant = { - { location = vector3(1064.84, -3199.84, -42.70), heading = 334.49, model = "bkr_prop_weed_lrg_01b"}, - { location = vector3(1063.88, -3198.69, -42.70), heading = 329.56, model = "bkr_prop_weed_lrg_01b"}, - { location = vector3(1061.68, -3196.46, -42.70), heading = 25.16, model = "bkr_prop_weed_lrg_01b"}, - { location = vector3(1061.62, -3199.63, -42.70), heading = 21.52, model = "bkr_prop_weed_lrg_01b"}, - { location = vector3(1062.82, -3197.70, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b"}, - { location = vector3(1064.69, -3196.31, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b"}, - { location = vector3(1062.92, -3198.78, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b"}, - { location = vector3(1049.73, -3201.92, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b"}, - { location = vector3(1052.94, -3202.21, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b"}, - { location = vector3(1051.93, -3201.17, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b"}, - { location = vector3(1050.98, -3201.13, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b"}, - { location = vector3(1050.89, -3200.07, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b"}, - { location = vector3(1050.89, -3198.95, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b"}, - { location = vector3(1049.72, -3198.95, -42.70), heading = 202.97, model = "bkr_prop_weed_lrg_01b"}, - -} -GlobalState.WeedPlant = weedPlant -Citizen.CreateThread(function() - for _, v in pairs(weedPlant) do - v.taken = false - end -end) - -function WeedCooldown(loc) - CreateThread(function() - Wait(Config.respawnTime * 1000) - weedPlant[loc].taken = false - GlobalState.WeedPlant = weedPlant - Wait(1000) - TriggerClientEvent('weed:respawnCane', -1, loc) - Log('Weed Plant Respawned At ' .. weedPlant[loc].location, 'weed') - end) -end - -RegisterNetEvent("weed:pickupCane", function(loc) - if CheckDist(source, weedPlant[loc].location) then return end - if not weedPlant[loc].taken then - weedPlant[loc].taken = true - GlobalState.WeedPlant = weedPlant - TriggerClientEvent("weed:removeCane", -1, loc) - WeedCooldown(loc) - AddItem(source, 'wetcannabis', 1) - Log(GetName(source) .. ' Picked Weed With a distance of ' .. dist(source, weedPlant[loc].location) .. ' vectors', 'weed') - end -end) --------------- events RegisterServerEvent('md-drugs:server:dryoutweed', function()