diff --git a/client/animationsandfunctions.lua b/client/animationsandfunctions.lua index 7a9425d..e03db4c 100644 --- a/client/animationsandfunctions.lua +++ b/client/animationsandfunctions.lua @@ -377,7 +377,7 @@ function SpawnCarPedChase() lib.requestModel("pounder", Config.RequestModelTime) lib.requestModel("ig_priest", Config.RequestModelTime) lib.requestModel("cargobob3", Config.RequestModelTime) - local leancar = CreateVehicle("pounder", start.x+3, start.y-2, start.z-1, 52.0, false, false) + 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) FreezeEntityPosition(pilot2, true) @@ -407,22 +407,7 @@ function SpawnCarPedChase() end end}, nil) else - repeat - Wait(1000) - until #(GetEntityCoords(driver) - GetEntityCoords(pilot2)) < 25.0 - Wait( 3 * 1000) - local heli = CreateVehicle("cargobob3", stoploc.x-20, stoploc.y-20, stoploc.z-1, 80, false,false) - Wait(1000) - if DoesEntityExist(heli) then - SetEntityInvincible(pilot2, false) - DeleteVehicle(leancar) - DeleteEntity(driver) - SetEntityAsMissionEntity(heli) - SetPedIntoVehicle(pilot2, heli, -1) - TaskHeliMission(pilot2, heli, 0, 0, -3362.05, 589.45, -13.04, 4, 150.0, 20.0, -1.0, 10, 10, 5.0, 0) - else - heli = CreateVehicle("cargobob3", stoploc.x-20, stoploc.y-20, stoploc.z-1, 80, false,false) - end + DeleteVehicle(leancar) DeleteEntity(driver) DeleteEntity(pilot2) end end end @@ -441,7 +426,7 @@ else lib.requestModel("journey", Config.RequestModelTime) lib.requestModel("a_m_m_hillbilly_02", Config.RequestModelTime) lib.requestModel("cargobob3", Config.RequestModelTime) - local methcar = CreateVehicle("journey", start.x+3, start.y-2, start.z-1, 52.0, false, false) + 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) FreezeEntityPosition(methpilot, true) @@ -472,23 +457,9 @@ else end, }, nil ) else - repeat - Wait(1000) - until #(GetEntityCoords(methdriver) - GetEntityCoords(methpilot)) < 25.0 - Wait( 3 * 1000) - local methheli = CreateVehicle("cargobob3", stoploc.x-20, stoploc.y-20, stoploc.z-1, 80, false,false) - Wait(1000) - if DoesEntityExist(methheli) then - SetEntityInvincible(methpilot, false) - CreatePickUpRopeForCargobob(methheli, 1) - AttachVehicleToCargobob(methheli, methcar, GetEntityBoneIndexByName(methcar, 'bodyshell'), 0.0, 0.0, 0.0) - DeleteEntity(methdriver) - SetEntityAsMissionEntity(methheli) - SetPedIntoVehicle(methpilot, methheli, -1) - TaskHeliMission(methpilot, methheli, 0, 0, -3362.05, 589.45, -13.04, 4, 150.0, 20.0, -1.0, 10, 10, 5.0, 0) - else - methheli = CreateVehicle("cargobob3", stoploc.x-20, stoploc.y-20, stoploc.z-1, 80, false,false) - end + DeleteVehicle(methcar) + DeleteEntity(methdriver) + DeleteEntity(methpilot) end end end diff --git a/client/heroin.lua b/client/heroin.lua index dae939d..1922e59 100644 --- a/client/heroin.lua +++ b/client/heroin.lua @@ -1,14 +1,15 @@ local PoppyPlants = {} local herointable = false +local dirty = false - local function createLabKit(coord, head) +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) PlaceObjectOnGroundProperly(heroinlabkit) AddMultiModel(heroinlabkit, { - { event = "md-drugs:client:heatliquidheroin", icon = "fa-solid fa-temperature-high", 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}}, - heroinlabkit) + {data = heroinlabkit, event = "md-drugs:client:heatliquidheroin", icon = "fa-solid fa-temperature-high", label = Lang.targets.heroin.cook, canInteract = function() if not dirty then return true end end}, + {data = heroinlabkit, event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.up, canInteract = function() if not dirty then return true end end}, + {data = heroinlabkit, event = "md-drugs:client:cleanheroinlabkit",icon = "fa-solid fa-hand-sparkles",label = Lang.targets.heroin.clean,canInteract = function() if dirty then return true end end}},heroinlabkit) end local function pickher(loc) @@ -88,16 +89,12 @@ RegisterNetEvent("md-drugs:client:heatliquidheroin", function(data) local loc, head = GetEntityCoords(data.data), GetEntityHeading(data.data) if not ItemCheck('emptyvial') then return end if not minigame() then + dirty = true TriggerServerEvent("md-drugs:server:failheatingheroin") - DeleteObject(data.data) - local dirtylabkitheroin = CreateObject("v_ret_ml_tablea", loc.x, loc.y, loc.z-1, true, false) - SetEntityHeading(dirtylabkitheroin, head) - PlaceObjectOnGroundProperly(dirtylabkitheroin) loadParticle("core") - local heroinkit = StartParticleFxLoopedOnEntity("exp_air_molotov", dirtylabkitheroin, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) + local heroinkit = StartParticleFxLoopedOnEntity("exp_air_molotov", data.data, 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) - AddMultiModel(dirtylabkitheroin, {{event = "md-drugs:client:cleanheroinlabkit",icon = "fa-solid fa-hand-sparkles",label = Lang.targets.heroin.clean, data = dirtylabkitheroin}}, nil ) return end if not progressbar(Lang.Heroin.success, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:heatliquidheroin") @@ -106,7 +103,8 @@ end) RegisterNetEvent("md-drugs:client:cleanheroinlabkit", function(data) if not ItemCheck('cleaningkit') then return end if not progressbar(Lang.Heroin.clean, 4000, 'clean') then return end - TriggerServerEvent("md-drugs:server:removecleaningkitheroin", data.data) + local done = lib.callback.await('removeCleaningkit', false) + if done then dirty = false end end) RegisterNetEvent("md-drugs:client:deletedirtyheroin", function(data) diff --git a/client/lsd.lua b/client/lsd.lua index a51a8bd..b9a509e 100644 --- a/client/lsd.lua +++ b/client/lsd.lua @@ -1,14 +1,25 @@ local tableout = false - +local dirtylsd = 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 = "fa-solid fa-temperature-high", label = Lang.targets.lsd.heat, data = labkit }, - { event = "md-drugs:client:refinequalityacid", icon = "fa-solid fa-temperature-high", label = Lang.targets.lsd.refine, data = labkit }, - { event = "md-drugs:client:maketabpaper", icon = "fa-regular fa-note-sticky", 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 } + { event = "md-drugs:client:heatliquid", icon = "fa-solid fa-temperature-high", label = Lang.targets.lsd.heat, data = labkit, canInteract = function() if not dirtylsd then return true end end }, + { event = "md-drugs:client:refinequalityacid", icon = "fa-solid fa-temperature-high", label = Lang.targets.lsd.refine, data = labkit,canInteract = function() if not dirtylsd then return true end end }, + { event = "md-drugs:client:maketabpaper", icon = "fa-regular fa-note-sticky", label = Lang.targets.lsd.dab, data = labkit, canInteract = function() if not dirtylsd then return true end end }, + { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.back, data = labkit, canInteract = function() if not dirtylsd then return true end end }, + {icon = "fa-solid fa-hand-sparkles", label = Lang.targets.lsd.clean, data = labkit, + action = function() + if not ItemCheck('cleaningkit') then return end + if not progressbar(Lang.lsd.clean, 4000, 'clean') then return end + local check = lib.callback.await('md-drugs:server:removecleaningkit') + if check then + dirtylsd = false + end + end, + canInteract = function() if dirtylsd then return true end end + } } AddMultiModel(labkit, options, labkit) end @@ -54,26 +65,10 @@ RegisterNetEvent("md-drugs:client:heatliquid", function(data) if not ItemCheck('lysergic_acid') then return end if not ItemCheck('diethylamide') then return end if not minigame() then - 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) + dirtylsd = true loadParticle(dict) - local 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) + local exitPtfx = StartParticleFxLoopedOnEntity("scr_dst_cocaine", data.data, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) SetParticleFxLoopedAlpha(exitPtfx, 3.0) - Wait(100) - AddSingleModel(dirtylabkit, {icon = "fa-solid fa-hand-sparkles", label = Lang.targets.lsd.clean, data = dirtylabkit, - action = function() - if not ItemCheck('cleaningkit') then return end - if not progressbar(Lang.lsd.clean, 4000, 'clean') then return end - local check = lib.callback.await('md-drugs:server:removecleaningkit') - if check then - DeleteObject(dirtylabkit) - createLabKit(PedCoords, head) - end - end - }, nil ) return end if not progressbar(Lang.lsd.heat, 7000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:heatliquid") diff --git a/server/heroin.lua b/server/heroin.lua index 9a4c25b..4f932bd 100644 --- a/server/heroin.lua +++ b/server/heroin.lua @@ -37,14 +37,15 @@ function heroinCooldown(loc) end) end -RegisterServerEvent('md-drugs:server:removecleaningkitheroin', function(data) -local src = source - if RemoveItem(src,"cleaningkit", 1) then - TriggerClientEvent("md-drugs:client:deletedirtyheroin", src, data) - Log(GetName(src) .. ' Wiped Down Their Heroin Lab Kit!' , 'heroin') - else - Notifys(src, "You cant clean it with spit alone", "error") +lib.callback.register('removeCleaningkit', function(source) + local Player = getPlayer(source) + for k, v in pairs(heroinLabKits) do + if v.ownerid == Player.PlayerData.citizenid then + RemoveItem(source, 'cleaningkit', 1) + return true + end end + return false end) RegisterServerEvent("heroin:pickupCane", function(loc) @@ -151,6 +152,7 @@ CUI('heroinlabkit', function(source, item) }) Notifys(src, Lang.Heroin.placed, "success") end + print(json.encode(heroinLabKits)) end) RegisterServerEvent('md-drugs:server:heatliquidheroin', function()