From 83f27491017369f0d2b27b6ad9cb1374aecb9ff5 Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Fri, 25 Oct 2024 01:55:35 -0700 Subject: [PATCH] remove blips| switch to waypoint. function spawning tables, code condense --- client/cocaine.lua | 13 ++++---- client/cornerselling.lua | 59 ++++++++++++++------------------- client/deliveries.lua | 56 ++++++++++---------------------- client/functions.lua | 24 +++++--------- client/heroin.lua | 70 +++++++++++++++------------------------- client/lsd.lua | 41 +++++++++++------------ client/mescaline.lua | 37 ++++++--------------- client/meth.lua | 5 ++- client/oxyruns.lua | 14 ++------ client/pharma.lua | 4 --- client/shrooms.lua | 5 ++- client/weed.lua | 25 ++++---------- client/wholesale.lua | 63 +++++++++++++++--------------------- 13 files changed, 147 insertions(+), 269 deletions(-) diff --git a/client/cocaine.lua b/client/cocaine.lua index d55dd90..9a2c4fa 100644 --- a/client/cocaine.lua +++ b/client/cocaine.lua @@ -48,7 +48,7 @@ AddEventHandler('onResourceStart', function(resource) LoadModel('prop_plant_01a') TriggerEvent('coke:init') end) - + AddEventHandler('onResourceStop', function(resourceName) if GetCurrentResourceName() == resourceName then SetModelAsNoLongerNeeded(GetHashKey('prop_plant_01a')) @@ -85,20 +85,19 @@ RegisterNetEvent("md-drugs:client:bagcoke", function() BagCoke() else if not progressbar(Lang.Coke.bagging, 5000, 'uncuff') then baggingcoke = nil return end - end + end TriggerServerEvent("md-drugs:server:bagcoke") baggingcoke = nil - end) CreateThread(function() if Config.FancyCokeAnims == false then - AddBoxZoneMulti('cuttcoke', Config.CuttingCoke, { type = "client", event = "md-drugs:client:cutcokeone", icon = "fas fa-sign-in-alt", label = Lang.targets.coke.cut}) - AddBoxZoneMulti('baggcoke', Config.BaggingCoke, { type = "client", event = "md-drugs:client:bagcoke", icon = "fas fa-sign-in-alt", label = Lang.targets.coke.bag}) + AddBoxZoneMulti('cuttcoke', Config.CuttingCoke, { type = "client", event = "md-drugs:client:cutcokeone", icon = "fa-solid fa-mortar-pestle", label = Lang.targets.coke.cut}) + AddBoxZoneMulti('baggcoke', Config.BaggingCoke, { type = "client", event = "md-drugs:client:bagcoke", icon = "fa-solid fa-sack-xmark", label = Lang.targets.coke.bag}) else AddBoxZoneSingle('cutcoke', vector3(1093.17, -3195.74, -39.19), - { type = "client", event = "md-drugs:client:cutcokeone", icon = "fas fa-sign-in-alt", label = Lang.targets.coke.cut, canInteract = function()if cuttingcoke == nil and baggingcoke == nil then return true end end }) + { type = "client", event = "md-drugs:client:cutcokeone", icon = "fa-solid fa-mortar-pestle", label = Lang.targets.coke.cut, canInteract = function()if cuttingcoke == nil and baggingcoke == nil then return true end end }) AddBoxZoneSingle('bagcokepowder', vector3(1090.29, -3195.66, -39.13), - { type = "client", event = "md-drugs:client:bagcoke", icon = "fas fa-sign-in-alt", label = Lang.targets.coke.bag, canInteract = function() if baggingcoke == nil and cuttingcoke == nil then return true end end }) + { type = "client", event = "md-drugs:client:bagcoke", icon = "fa-solid fa-sack-xmark", label = Lang.targets.coke.bag, canInteract = function() if baggingcoke == nil and cuttingcoke == nil then return true end end }) end end) diff --git a/client/cornerselling.lua b/client/cornerselling.lua index 2414e64..f984d2c 100644 --- a/client/cornerselling.lua +++ b/client/cornerselling.lua @@ -3,40 +3,33 @@ local sell = false local sold = false local targbusy = false +local function reset(targ) + FreezeEntityPosition(targ, false) + ClearPedTasks(targ) + Wait(10000) + DeletePed(targ) + targbusy = false + sold = true +end + local function sellDrug(item, amount, price, targ) PoliceCall(20) targbusy = true if IsPedInAnyVehicle(PlayerPedId(), true) then Notify(Lang.Cornerselling.inveh, 'error') - FreezeEntityPosition(targ, false) - ClearPedTasks(targ) - Wait(10000) - DeletePed(targ) - targbusy = false - sold = true - sell = false + reset(targ) return end if not progressbar(string.format(Lang.Cornerselling.selling, GetLabel(item), price), 4000, 'uncuff') then return end TriggerServerEvent('md-drugs:server:sellCornerDrugs', item, amount, price) - FreezeEntityPosition(targ, false) - ClearPedTasks(targ) - Wait(10000) - DeletePed(targ) - targbusy = false - sold = true + reset(targ) end local function deny(targ) PoliceCall(20) targbusy = true if not progressbar(Lang.Cornerselling.deny, 4000, 'argue5') then return end - FreezeEntityPosition(targ, false) - ClearPedTasks(targ) - Wait(10000) - DeletePed(targ) - targbusy = false - sold = true -end + reset(targ) +end function Cornersell() local targ = lib.GetClosestPed(GetEntityCoords(PlayerPedId()), 8) @@ -48,27 +41,24 @@ function Cornersell() until #(GetEntityCoords(PlayerPedId()) - GetEntityCoords(targ)) < 2.0 lib.requestAnimDict("rcmme_tracey1") TaskStartScenarioInPlace(targ, "WORLD_HUMAN_STAND_IMPATIENT_UPRIGHT", 0, false) FreezeEntityPosition(targ, true) - local item, amount, price = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false) if item == 'nothing' then Notify(Lang.Cornerselling.nodrugs, 'error') sell = false FreezeEntityPosition(targ, false) ClearPedTasks(targ) return false end local options = { - { label = string.format(Lang.Targets.CornerSell.sell, amount, GetLabel(item), price), icon = "fas fa-eye", - action = function() sellDrug(item, amount, price, targ) end, - onSelect = function() sellDrug(item, amount, price, targ) end, + { label = string.format(Lang.Targets.CornerSell.sell, amount, GetLabel(item), price), icon ="fa-solid fa-money-bill", + action = function() sellDrug(item, amount, price, targ) end, canInteract = function() if not targbusy then return true end end, }, - { label = Lang.targets.CornerSell.deny, icon = "fas fa-eye", - action = function() deny(targ) end, - onSelect = function() deny(targ) end, - canInteract = function() - if not targbusy then return true end end, + { label = Lang.targets.CornerSell.deny, icon = "fa-solid fa-person-harassing", + action = function() deny(targ) end, + canInteract = function() + if not targbusy then return true end end, }, } AddMultiModel(targ, options, nil) repeat Wait(1000) - until sold + until sold if sold then sold = false return true end end @@ -76,7 +66,7 @@ RegisterNetEvent('md-drugs:client:cornerselling', function() if not GetCops(QBConfig.MinimumDrugSalePolice) then return end local item, amount, price = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false) if item ~= 'nothing' then - if sell then + if sell then Notify(Lang.Cornerselling.stop, 'error') sell = false else @@ -84,11 +74,10 @@ RegisterNetEvent('md-drugs:client:cornerselling', function() Notify(Lang.Cornerselling.start, 'success') repeat Wait(1000) - if not Cornersell() then end - until sell == false + if not Cornersell() then end + until not sell end else Notify(Lang.Cornerselling.nodrugs, 'error') end -end) - +end) \ No newline at end of file diff --git a/client/deliveries.lua b/client/deliveries.lua index d2d96f9..00f63bc 100644 --- a/client/deliveries.lua +++ b/client/deliveries.lua @@ -17,9 +17,7 @@ CreateThread(function() dealer[k] = CreatePed(0, Ped,loc.x,loc.y, loc.z-1, loc.h, false, false) Freeze(dealer[k], true, loc.h) local options = { - { - icon = 'fas fa-user-secret', - label = string.format(Lang.targets.Delivery.Deliver, v.name), + { icon = 'fas fa-user-secret', label = string.format(Lang.targets.Delivery.Deliver, v.name), action = function() local bool, item, amount, coords = lib.callback.await('md-drugs:server:GetDeliveryItem', false, k) if bool then @@ -27,19 +25,9 @@ CreateThread(function() TriggerEvent('md-drugs:client:setLocation', {bool = bool, item = item, amount = amount, coords = coords}) end end, - onSelect = function() - local bool, item, amount, coords = lib.callback.await('md-drugs:server:GetDeliveryItem', false, k) - if item then - TriggerEvent('md-drugs:client:setLocation', {bool = bool, item = item, amount = amount, coords = coords}) - Email(Lang.Delivery.emailn, Lang.Delivery.emailsub, string.format(Lang.Delivery.emailcon, amount, GetLabel(item))) - end - end }, - { - icon = 'fas fa-user-secret', - label = string.format(Lang.targets.Delivery.open, v.name), + { icon = 'fas fa-user-secret', label = string.format(Lang.targets.Delivery.open, v.name), action = function() TriggerEvent('md-drugs:client:opendealermenu') end, - onSelect = function() TriggerEvent('md-drugs:client:opendealermenu') end } } AddMultiModel(dealer[k], options) @@ -48,34 +36,24 @@ end) RegisterNetEvent('md-drugs:client:setLocation', function(data) local coord = json.decode(data.coords) - local deliveryBlip = AddBlipForCoord(coord.x, coord.y, coord.z) - SetBlipSprite(deliveryBlip, 1) - SetBlipDisplay(deliveryBlip, 2) - SetBlipScale(deliveryBlip, 1.0) - SetBlipAsShortRange(deliveryBlip, false) - SetBlipColour(deliveryBlip, 27) - BeginTextCommandSetBlipName("STRING") - AddTextComponentSubstringPlayerName('Drug Delivery') - EndTextCommandSetBlipName(deliveryBlip) - SetBlipRoute(deliveryBlip, true) + SetNewWaypoint(coord.x, coord.y) if isActive then return end isActive = true local Buyer = CreatePed(0, "g_m_y_famdnf_01",coord.x, coord.y, coord.z-1, 180.0, false, false) Freeze(Buyer, true, 180) - AddSingleModel(Buyer, { - icon = 'fas fa-user-secret', - label = Lang.targets.Delivery.hand, - action = function() - if not progressbar(Lang.Delivery.pack, 4000, 'uncuff') then return end - isActive = false - DeletePed(Buyer) - RemoveBlip(deliveryBlip) - TriggerServerEvent('md-drugs:server:giveDeliveryItems', data.item, data.amount) - end, - canInteract = function() - if isActive then - return true - end + AddSingleModel(Buyer, { + icon = 'fas fa-user-secret', + label = Lang.targets.Delivery.hand, + action = function() + if not progressbar(Lang.Delivery.pack, 4000, 'uncuff') then return end + isActive = false + DeletePed(Buyer) + TriggerServerEvent('md-drugs:server:giveDeliveryItems', data.item, data.amount) + end, + canInteract = function() + if isActive then + return true end - }, nil) + end + }, nil) end) \ No newline at end of file diff --git a/client/functions.lua b/client/functions.lua index c88cda4..d8ab2d2 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -368,22 +368,6 @@ function tele(coords) DoScreenFadeIn(500) end -function Blip(entity, text) - local deliveryBlip = AddBlipForCoord(entity) - SetBlipSprite(deliveryBlip, 1) - SetBlipDisplay(deliveryBlip, 2) - SetBlipScale(deliveryBlip, 1.0) - SetBlipAsShortRange(deliveryBlip, false) - SetBlipColour(deliveryBlip, 27) - BeginTextCommandSetBlipName("STRING") - AddTextComponentSubstringPlayerName(text) - EndTextCommandSetBlipName(deliveryBlip) - SetBlipRoute(deliveryBlip, true) -end - -function RemoveBlips() - RemoveBlip(deliveryBlip) -end function AddBoxZoneSingle(name, loc, data) if Config.Target == 'qb' then @@ -476,6 +460,14 @@ function AddSingleModel(model, data, num) end function AddMultiModel(model, data, num) + local data = {} + for k, v in pairs (data) do + table.insert(data,{ + { icon = v.icon, label = v.label, event = v.event or nil, action = v.action or nil, + onSelect = v.action,data = num,canInteract = v.canInteract or nil, + } + }) + end if Config.Target == 'qb' then exports['qb-target']:AddTargetEntity(model, {options = data, distance = 2.5}) elseif Config.Target == 'ox' then diff --git a/client/heroin.lua b/client/heroin.lua index ffc354f..c326f76 100644 --- a/client/heroin.lua +++ b/client/heroin.lua @@ -2,10 +2,16 @@ local QBCore = exports['qb-core']:GetCoreObject() local PoppyPlants = {} local herointable = false -local options = { - { event = "md-drugs:client:heatliquidheroin", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.cook, data = heroinlabkit}, - { event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.up, data = heroinlabkit, canInteract = function() if herointable then return true end end}, - } + local function createLabKit(coord, head) + local heroinlabkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false) + SetEntityHeading(heroinlabkit, head) + PlaceObjectOnGroundProperly(heroinlabkit) + local options = { + { event = "md-drugs:client:heatliquidheroin", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.cook, data = heroinlabkit}, + { event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.up, data = heroinlabkit, canInteract = function() if herointable then return true end end}, + } + AddMultiModel(heroinlabkit, options, heroinlabkit) +end local function pickher(loc) if not progressbar(Lang.Heroin.pick, 4000, 'uncuff') then return end @@ -21,26 +27,21 @@ local Ped = "g_m_y_famdnf_01" AddSingleModel(heroinkitdealer, { label = Lang.targets.heroin.kit, icon = "fas fa-eye", event = "md-drugs:client:buyheroinlabkit", distance = 2.0}, nil ) end) ----- plant spawns dont edit 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) - AddSingleModel(PoppyPlants[loc], {icon = "fas fa-hand", label = Lang.targets.heroin.pick, action = function() pickher(loc) end}, loc ) + AddSingleModel(PoppyPlants[loc], {icon = "fas fa-hand", label = Lang.targets.heroin.pick, action = function() pickher(loc) end}, 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) @@ -48,7 +49,7 @@ RegisterNetEvent("heroin:init", function() 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) - AddSingleModel(PoppyPlants[k], {icon = "fas fa-hand", label = Lang.targets.heroin.pick, action = function() pickher(k) end}, k ) + AddSingleModel(PoppyPlants[k], {icon = "fas fa-hand", label = Lang.targets.heroin.pick, action = function() pickher(k) end}, k ) end end end) @@ -75,11 +76,7 @@ AddEventHandler('onResourceStart', function(resource) end end end - DeleteObject(heroinlabkit) - DeleteObject(dirtylabkitheroin) end) ----- plant stop end - RegisterNetEvent("md-drugs:client:dryplant", function(data) if not progressbar(Lang.Heroin.dryout, 4000, 'uncuff') then return end @@ -97,26 +94,20 @@ RegisterNetEvent("md-drugs:client:buyheroinlabkit", function() TriggerServerEvent("md-drugs:server:getheroinlabkit") end) - RegisterNetEvent("md-drugs:client:setheroinlabkit", function() -if herointable then - Notify(Lang.Heroin.tableout, 'error') -else - herointable = true - local location, head = StartRay() - if not location then herointable = false TriggerServerEvent('md-drugs:server:getheroinlabkitback') return end - if not progressbar(Lang.Heroin.table, 4000, 'uncuff') then TriggerServerEvent('md-drugs:server:getheroinlabkitback') return end - heroinlabkit = CreateObject("v_ret_ml_tablea", location.x, location.y, location.z, true, false) - SetEntityHeading(heroinlabkit, head) - PlaceObjectOnGroundProperly(heroinlabkit) - AddMultiModel(heroinlabkit, options, heroinlabkit) -end + if herointable then + Notify(Lang.Heroin.tableout, 'error') + else + herointable = true + local location, head = StartRay() + if not location then herointable = false TriggerServerEvent('md-drugs:server:getheroinlabkitback') return end + if not progressbar(Lang.Heroin.table, 4000, 'uncuff') then TriggerServerEvent('md-drugs:server:getheroinlabkitback') return end + createLabKit(location, head) + end end) - RegisterNetEvent("md-drugs:client:heatliquidheroin", function(data) - local loc = GetEntityCoords(data.data) - local head = GetEntityHeading(data.data) + local loc, head = GetEntityCoords(data.data), GetEntityHeading(data.data) if not ItemCheck('emptyvial') then return end if not minigame() then TriggerServerEvent("md-drugs:server:failheatingheroin") @@ -130,7 +121,7 @@ RegisterNetEvent("md-drugs:client:heatliquidheroin", function(data) SetPedToRagdoll(PlayerPedId(), 1300, 1300, 0, 0, 0, 0) AddMultiModel(dirtylabkitheroin, {event = "md-drugs:client:cleanheroinlabkit",icon = "fas fa-box-circle-check",label = Lang.target.heroin.clean, data = dirtylabkitheroin}, nil ) return end - if not progressbar(Lang.Heroin.success, 4000, 'uncuff') then return end + if not progressbar(Lang.Heroin.success, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:heatliquidheroin") end) @@ -142,17 +133,11 @@ RegisterNetEvent("md-drugs:client:cleanheroinlabkit", function(data) end) RegisterNetEvent("md-drugs:client:deletedirtyheroin", function(data) -local location = GetEntityCoords(data) -local head = GetEntityHeading(data) + local location,head = GetEntityCoords(data), GetEntityHeading(data) DeleteObject(data) - local heroinlabkit = CreateObject("v_ret_ml_tablea", location.x, location.y, location.z-1, true, false) - SetEntityHeading(heroinlabkit, head) - PlaceObjectOnGroundProperly(heroinlabkit) - AddMultiModel(heroinlabkit, options, heroinlabkit) + createLabKit(location, head) end) - - RegisterNetEvent("md-drugs:client:getheroinkitback", function(data) if not progressbar(Lang.Heroin.pickup, 4000, 'uncuff') then return end herointable = false @@ -160,11 +145,8 @@ RegisterNetEvent("md-drugs:client:getheroinkitback", function(data) TriggerServerEvent("md-drugs:server:getheroinlabkitback") end) - RegisterNetEvent("md-drugs:client:fillneedle", function(data) if not minigame() then TriggerServerEvent("md-drugs:server:failheroin", data.data) return end if not progressbar(Lang.Heroin.needles, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:fillneedle", data.data) -end) - - +end) \ No newline at end of file diff --git a/client/lsd.lua b/client/lsd.lua index 63a40ce..8eb550c 100644 --- a/client/lsd.lua +++ b/client/lsd.lua @@ -2,10 +2,21 @@ local QBCore = exports['qb-core']:GetCoreObject() local tableout = false - +local function createLabKit(coord, head) + local labkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false) + SetEntityHeading(labkit, head) + PlaceObjectOnGroundProperly(labkit) + local options = { + { event = "md-drugs:client:heatliquid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.heat, data = labkit }, + { event = "md-drugs:client:refinequalityacid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.refine, data = labkit }, + { event = "md-drugs:client:maketabpaper", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.dab, data = labkit }, + { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.back, data = labkit, canInteract = function() return tableout end } + } + AddMultiModel(labkit, options, labkit) +end CreateThread(function() -local Ped = "g_m_y_famdnf_01" + local Ped = "g_m_y_famdnf_01" lib.requestModel(Ped, Config.RequestModelTime) local tabdealer = CreatePed(0, Ped,Config.buylsdlabkit.x,Config.buylsdlabkit.y,Config.buylsdlabkit.z-1, Config.buylsdlabkit.w, false, false) Freeze(tabdealer, true, Config.buylsdlabkit.w) @@ -35,16 +46,7 @@ else local loc, head = StartRay() if not loc then tableout = false TriggerServerEvent('md-drugs:server:getlabkitback') return end if not progressbar(Lang.lsd.place, 4000, 'uncuff') then TriggerServerEvent('md-drugs:server:getlabkitback') return end - local labkit = CreateObject("v_ret_ml_tablea", loc.x, loc.y, loc.z-1, true, false) - SetEntityHeading(labkit, head) - PlaceObjectOnGroundProperly(labkit) - local options = { - { event = "md-drugs:client:heatliquid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.heat, data = labkit, }, - { event = "md-drugs:client:refinequalityacid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.refine, data = labkit, }, - { event = "md-drugs:client:maketabpaper", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.dab, data = labkit, }, - { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.back, data = labkit, canInteract = function() if tableout then return true end end}, - } - AddMultiModel(labkit, options, labkit) + createLabKit(loc, head) end end) @@ -56,7 +58,7 @@ RegisterNetEvent("md-drugs:client:getlabkitback", function(data) end) RegisterNetEvent("md-drugs:client:heatliquid", function(data) - local PedCoords = GetEntityCoords(data.data) + local PedCoords, head = GetEntityCoords(data.data), GetEntityHeading(data.data) local dict = "scr_ie_svm_technical2" if not ItemCheck('lysergic_acid') then return end if not ItemCheck('diethylamide') then return end @@ -64,6 +66,7 @@ RegisterNetEvent("md-drugs:client:heatliquid", function(data) TriggerServerEvent("md-drugs:server:failheating") DeleteObject(data.data) local dirtylabkit = CreateObject("v_ret_ml_tablea", PedCoords.x, PedCoords.y, PedCoords.z-1, true, false) + SetEntityHeading(dirtylabkit, head) loadParticle(dict) exitPtfx = StartParticleFxLoopedOnEntity("scr_dst_cocaine", dirtylabkit, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) PlaceObjectOnGroundProperly(dirtylabkit) @@ -80,17 +83,9 @@ RegisterNetEvent("md-drugs:client:cleanlabkit", function(data) if not progressbar(Lang.lsd.clean, 4000, 'clean') then return end local check = lib.callback.await('md-drugs:server:removecleaningkit') if check then - local coord = GetEntityCoords(data.data) + local coord, head = GetEntityCoords(data.data), GetEntityHeading(data.data) DeleteObject(data.data) - local labkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z-1, true, false) - PlaceObjectOnGroundProperly(labkit) - local options = { - { event = "md-drugs:client:heatliquid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.heat, data = labkit, }, - { event = "md-drugs:client:refinequalityacid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.refine, data = labkit, }, - { event = "md-drugs:client:maketabpaper", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.dab, data = labkit, }, - { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.back, data = labkit, canInteract = function() if tableout then return true end end}, - } - AddMultiModel(labkit, options, labkit) + createLabKit(coord, head) end end) diff --git a/client/mescaline.lua b/client/mescaline.lua index a8d3ace..2b6d7f0 100644 --- a/client/mescaline.lua +++ b/client/mescaline.lua @@ -24,15 +24,11 @@ RegisterNetEvent('Mescaline:respawnCane', function(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) @@ -69,43 +65,28 @@ AddEventHandler('onResourceStart', function(resource) end end) - - RegisterNetEvent("md-drugs:client:drymescaline", function() if not ItemCheck('cactusbulb') then return end if not progressbar(Lang.mescaline.dry, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:drymescaline") end) - RegisterNetEvent("md-drugs:client:takemescaline", function() -local chance = math.random(1,100) -local chance2 = math.random(1,100) + local chance, chance2 = math.random(1,100), math.random(1,100) + local weapon = '' + if chance2 == 100 then weapon = 'weapon_rpg' else weapon = 'weapon_flaregun' end if not progressbar(Lang.mescaline.eat, 4000, 'uncuff') then return end if chance <= Config.Badtrip then AlienEffect() local clone = ClonePed(PlayerPedId(), false, false, true) SetEntityAsMissionEntity(clone) - SetEntityVisible(clone, true) - SetPedRelationshipGroupHash(clone) - SetPedAccuracy(clone) - SetPedArmour(clone) - SetPedCanSwitchWeapon(clone, true) SetPedFleeAttributes(clone, false) - if chance2 <= 99 then - GiveWeaponToPed(clone, "weapon_flaregun", 1, false, true) - TaskCombatPed(clone, PlayerPedId(), 0, 16) - SetPedCombatAttributes(clone, 46, true) - Wait(1000 * 30) - DeleteEntity(clone) - else - GiveWeaponToPed(clone, "weapon_rpg", 1, false, true) - TaskCombatPed(clone, PlayerPedId(), 0, 16) - SetPedCombatAttributes(clone, 46, true) - Wait(1000 * 30) - DeleteEntity(clone) - end + GiveWeaponToPed(clone, weapon, 1, false, true) + TaskCombatPed(clone, PlayerPedId(), 0, 16) + SetPedCombatAttributes(clone, 46, true) + Wait(1000 * 30) + DeleteEntity(clone) else AlienEffect() - end + end end) diff --git a/client/meth.lua b/client/meth.lua index bf1b0a1..8e382f6 100644 --- a/client/meth.lua +++ b/client/meth.lua @@ -83,18 +83,17 @@ CreateThread(function() end) CreateThread(function() - AddBoxZoneSingle("methTeleOut",Config.MethTeleIn, {name = 'teleout', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.enter, action = function() SetEntityCoords(PlayerPedId(), Config.MethTeleOut) end} ) AddBoxZoneSingle("methtelein",Config.MethTeleOut, {name = 'teleout', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.exit, action = function() SetEntityCoords(PlayerPedId(), Config.MethTeleIn) end} ) local options = { - { name = 'methcook', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.cook, distance = 2.5, action = function() startcook() end, onSelect = function() startcook() end, + { name = 'methcook', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.cook, distance = 2.5, action = function() startcook() end, canInteract = function() if amonia == nil and active == nil then return true end end, }, - { name = 'grabtray', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.tray, distance = 2.5, onSelect = function() trayscarry() end, action = function() trayscarry() end, + { name = 'grabtray', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.tray, distance = 2.5, action = function() trayscarry() end, canInteract = function() if heated and amonia and tray == nil then return true end end, diff --git a/client/oxyruns.lua b/client/oxyruns.lua index 391d5b2..9ad39a8 100644 --- a/client/oxyruns.lua +++ b/client/oxyruns.lua @@ -1,5 +1,4 @@ local QBCore = exports['qb-core']:GetCoreObject() -local deliveryBlip = nil local carryPackage = nil RegisterNetEvent("md-drugs:client:GetOxyCar", function() @@ -19,16 +18,7 @@ end) RegisterNetEvent("md-drugs:client:getoxylocationroute", function() local CurrentLocation = Config.oxylocations[math.random(#Config.oxylocations)] if CurrentLocation ~= nil then - local deliveryBlip = AddBlipForCoord(CurrentLocation) - SetBlipSprite(deliveryBlip, 1) - SetBlipDisplay(deliveryBlip, 2) - SetBlipScale(deliveryBlip, 1.0) - SetBlipAsShortRange(deliveryBlip, false) - SetBlipColour(deliveryBlip, 27) - BeginTextCommandSetBlipName("STRING") - AddTextComponentSubstringPlayerName('Oxy Buyer') - EndTextCommandSetBlipName(deliveryBlip) - SetBlipRoute(deliveryBlip, true) + SetNewWaypoint(CurrentLocation.x, CurrentLocation.y) local current = "g_m_y_famdnf_01" lib.requestModel(current, Config.RequestModelTime) local oxybuyer = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false) @@ -36,7 +26,7 @@ RegisterNetEvent("md-drugs:client:getoxylocationroute", function() repeat Wait(1000) until #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x,CurrentLocation.y,CurrentLocation.z)) < 5.0 - RemoveBlip(deliveryBlip) + PoliceCall(Config.PoliceAlertOxy) AddSingleModel(oxybuyer, { type = "client", label = Lang.targets.oxy.talk, icon = "fas fa-eye", action = function() diff --git a/client/pharma.lua b/client/pharma.lua index 95759a0..404cd07 100644 --- a/client/pharma.lua +++ b/client/pharma.lua @@ -19,20 +19,16 @@ else end end) - - RegisterNetEvent("md-drugs:client:writeprescription", function(args) if not progressbar(Lang.Pharma.write, 4000, 'notepad') then return end TriggerServerEvent("md-drugs:server:giveprescription", args.item) end) - RegisterNetEvent("md-drugs:client:fillprescription", function(data) if not progressbar(Lang.Pharma.fill, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:fillprescription", data.data) end) - RegisterNetEvent("md-drugs:client:unbottle", function(item) if not progressbar(Lang.Pharma.open, 4000, 'uncuff') then return end if item.name == 'vicodinbottle' then item = 'vicodin' end diff --git a/client/shrooms.lua b/client/shrooms.lua index c5baefa..29fde38 100644 --- a/client/shrooms.lua +++ b/client/shrooms.lua @@ -1,7 +1,6 @@ local QBCore = exports['qb-core']:GetCoreObject() local shrooms = {} - function LoadModel(hash) hash = GetHashKey(hash) RequestModel(hash) @@ -14,6 +13,7 @@ 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) @@ -23,6 +23,7 @@ RegisterNetEvent('shrooms:respawnCane', function(loc) AddSingleModel(shrooms[loc],{ icon = "fas fa-hand", label = Lang.targets.shrooms.pick, action = function() pick(loc) end }, loc ) end end) + AddEventHandler('onResourceStart', function(resource) if resource == GetCurrentResourceName() then Wait(3000) @@ -53,7 +54,6 @@ end) TriggerEvent('shrooms:init') end) - RegisterNetEvent("shrooms:init", function() for k, v in pairs (GlobalState.shrooms) do local hash = GetHashKey(v.model) @@ -66,7 +66,6 @@ end) end end) - RegisterNetEvent('md-drugs:client:takeshrooms', function() if not progressbar(Lang.Shrooms.eat, 500, 'eat') then return end TriggerEvent("evidence:client:SetStatus", "widepupils", 300) diff --git a/client/weed.lua b/client/weed.lua index a0d7624..c79ddc1 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -19,7 +19,6 @@ local function hasJob() return true end end - RegisterNetEvent('weed:respawnCane', function(loc) local v = GlobalState.WeedPlant[loc] local hash = GetHashKey(v.model) @@ -27,15 +26,10 @@ RegisterNetEvent('weed:respawnCane', function(loc) 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() - if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end - TriggerServerEvent("weed:pickupCane", loc) - end - }, loc) + AddSingleModel(WeedPlant[loc], + {icon = "fas fa-hand",label = Lang.targets.weed.pick, + action = function()if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end TriggerServerEvent("weed:pickupCane", loc) end}, + loc) end end) @@ -52,14 +46,9 @@ RegisterNetEvent("weed:init", function() 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() - if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end - TriggerServerEvent("weed:pickupCane", k) - end - }, k) + {icon = "fas fa-hand",label = Lang.targets.weed.pick, + action = function()if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end TriggerServerEvent("weed:pickupCane", k) end}, + k) end end end) diff --git a/client/wholesale.lua b/client/wholesale.lua index 4ccf90c..f4f42eb 100644 --- a/client/wholesale.lua +++ b/client/wholesale.lua @@ -1,6 +1,6 @@ local QBCore = exports['qb-core']:GetCoreObject() local miss = false -local deliveryBlip = nil + RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify) if not GetCops(Config.PoliceCount) then return end @@ -12,16 +12,7 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify) local CurrentLocation = Config.oxylocations[math.random(#Config.oxylocations)] local timer = 0 miss = true - deliveryBlip = AddBlipForCoord(CurrentLocation) - SetBlipSprite(deliveryBlip, 1) - SetBlipDisplay(deliveryBlip, 2) - SetBlipScale(deliveryBlip, 1.0) - SetBlipAsShortRange(deliveryBlip, false) - SetBlipColour(deliveryBlip, 27) - BeginTextCommandSetBlipName("STRING") - AddTextComponentSubstringPlayerName("drug Meet") - EndTextCommandSetBlipName(deliveryBlip) - SetBlipRoute(deliveryBlip, true) + SetNewWaypoint(CurrentLocation.x, CurrentLocation.y) lib.requestModel("g_m_y_famdnf_01", Config.RequestModelTime) local current = "g_m_y_famdnf_01" local drugdealer = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, 90.0, false, false) @@ -32,25 +23,24 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify) label = Lang.Wholesale.talk, icon = "fas fa-eye", action = function() - local luck = math.random(1,100) - if luck >=101 then - TriggerEvent("md-drugs:client:SuccessSale", drug) - Wait(4000) - DeleteEntity(drugdealer) - else - TriggerEvent("md-drugs:client:SetUp") - Wait(3000) - DeleteEntity(drugdealer) - end - miss = false - end, + local luck = math.random(1,100) + if luck >=101 then + TriggerEvent("md-drugs:client:SuccessSale", drug) + Wait(4000) + DeleteEntity(drugdealer) + else + TriggerEvent("md-drugs:client:SetUp") + Wait(3000) + DeleteEntity(drugdealer) + end + miss = false + end, },nil ) repeat Wait(1000) timer = timer + 1 until #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x, CurrentLocation.y, CurrentLocation.z) ) < 4.0 or timer == Config.WholesaleTimeout + 1 PoliceCall(Config.AlertPoliceWholesale) - RemoveBlip(deliveryBlip) if timer <= Config.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x, CurrentLocation.y, CurrentLocation.z) ) < 4.0 then timer = 0 else @@ -62,21 +52,20 @@ end) RegisterNetEvent("md-drugs:client:SuccessSale", function(drug) - if not progressbar("Wholesaling Drugs", 4000, 'uncuff') then return end - if drug == 'coke' then - TriggerServerEvent("md-drugs:server:wholesalecoke") - elseif drug == 'crack' then - TriggerServerEvent("md-drugs:server:wholesalecrack") - elseif drug == 'lsd' then - TriggerServerEvent("md-drugs:server:wholesalelsd") - elseif drug == 'heroin' then - TriggerServerEvent("md-drugs:server:wholesaleheroin") - elseif drug == 'xtc' then - TriggerEvent("md-drugs:client:wholesalextc") - end + if not progressbar("Wholesaling Drugs", 4000, 'uncuff') then return end + if drug == 'coke' then + TriggerServerEvent("md-drugs:server:wholesalecoke") + elseif drug == 'crack' then + TriggerServerEvent("md-drugs:server:wholesalecrack") + elseif drug == 'lsd' then + TriggerServerEvent("md-drugs:server:wholesalelsd") + elseif drug == 'heroin' then + TriggerServerEvent("md-drugs:server:wholesaleheroin") + elseif drug == 'xtc' then + TriggerEvent("md-drugs:client:wholesalextc") + end end) - RegisterNetEvent("md-drugs:client:SetUp", function() progressbar("YOU FUCKED NOW", 4000, 'uncuff') SetUpPeds()