diff --git a/client/animationsandfunctions.lua b/client/animationsandfunctions.lua index 5d152aa..e8fef1a 100644 --- a/client/animationsandfunctions.lua +++ b/client/animationsandfunctions.lua @@ -1,121 +1,5 @@ local started = nil -function CutCoke(coords, offset, rotation) - local animDict, animName = "anim@amb@business@coc@coc_unpack_cut_left@", "coke_cut_v5_coccutter" - 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 - local scenes = { - { - { hash = "bkr_prop_coke_bakingsoda_o", animName = "coke_cut_v5_bakingsoda"}, - { hash = "prop_cs_credit_card", animName = "coke_cut_v5_creditcard"}, - { hash = "prop_cs_credit_card", animName = "coke_cut_v5_creditcard^1"} - }, -} - local scenesList, entitiesList = {}, {} - for i=1, #scenes, 1 do - local scene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) - NetworkAddPedToSynchronisedScene(ped, scene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) - for j=1, #scenes[i], 1 do - local s = scenes[i][j] - RequestModel(s.hash) - while not HasModelLoaded(s.hash) do - Wait(0) - end - local obj = CreateObjectNoOffset(s.hash, coords, true, true, true) - SetModelAsNoLongerNeeded(s.hash) - entitiesList[#entitiesList+1] = obj - NetworkAddEntityToSynchronisedScene(obj, scene, animDict, s.animName, 4.0, -8.0, 1) - end - scenesList[#scenesList+1] = scene - end - DisableCamCollisionForEntity(ped) - FreezeEntityPosition(ped, true) - for i=1, #scenesList, 1 do - NetworkStartSynchronisedScene(scenesList[i]) - end - - Wait(animDuration-11000) - for i=1, #scenesList, 1 do - NetworkStopSynchronisedScene(scenesList[i]) - end - for i=1, #entitiesList, 1 do - DeleteEntity(entitiesList[i]) - end - RemoveAnimDict(animDict) - FreezeEntityPosition(ped, false) -end - -CreateThread(function() - BikerCocaine = exports['bob74_ipl']:GetBikerCocaineObject() - BikerCocaine.Style.Set(BikerCocaine.Style.upgrade) - BikerCocaine.Security.Set(BikerCocaine.Security.upgrade) - BikerCocaine.Details.Enable({BikerCocaine.Details.cokeBasic1, BikerCocaine.Details.cokeBasic2, BikerCocaine.Details.cokeBasic3}, true) -end) - -function BagCoke(coords, offset, rotation) -local ver = "" - local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01" - 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 - local scenes = { - { - { hash = "bkr_prop_coke_cutblock_01", animName = "break_weigh_"..ver.."box01"}, - { hash = "bkr_prop_coke_fullmetalbowl_02", animName = "break_weigh_"..ver.."box01^1"}, - { hash = "bkr_prop_coke_cutblock_01", animName = "break_weigh_"..ver.."methbag01"} - }, - { - { hash = "xm3_prop_xm3_bag_coke_01a", animName = "break_weigh_"..ver.."methbag01^1"}, - { hash = "xm3_prop_xm3_bag_coke_01a", animName = "break_weigh_"..ver.."methbag01^2"}, - { hash = "xm3_prop_xm3_bag_coke_01a", animName = "break_weigh_"..ver.."methbag01^3"} - }, - { - { hash = "bkr_prop_coke_fullscoop_01a", animName = "break_weigh_"..ver.."scoop"}, - { hash = "bkr_prop_coke_scale_01", animName = "break_weigh_"..ver.."scale"}, - { hash = "bkr_prop_fakeid_penclipboard", animName = "break_weigh_"..ver.."pen"} - }, - { - { hash = "bkr_prop_fakeid_clipboard_01a", animName = "break_weigh_"..ver.."clipboard"}, - - } -} -local scenesList, entitiesList = {}, {} -for i=1, #scenes, 1 do - local scene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) - NetworkAddPedToSynchronisedScene(ped, scene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) - for j=1, #scenes[i], 1 do - local s = scenes[i][j] - RequestModel(s.hash) - while not HasModelLoaded(s.hash) do - Wait(0) - end - local obj = CreateObjectNoOffset(s.hash, coords, true, true, true) - SetModelAsNoLongerNeeded(s.hash) - entitiesList[#entitiesList+1] = obj - NetworkAddEntityToSynchronisedScene(obj, scene, animDict, s.animName, 4.0, -8.0, 1) - end - scenesList[#scenesList+1] = scene -end -DisableCamCollisionForEntity(ped) -FreezeEntityPosition(ped, true) -for i=1, #scenesList, 1 do - NetworkStartSynchronisedScene(scenesList[i]) -end - -Wait(animDuration-11000) -for i=1, #scenesList, 1 do - NetworkStopSynchronisedScene(scenesList[i]) -end -for i=1, #entitiesList, 1 do - DeleteEntity(entitiesList[i]) -end -RemoveAnimDict(animDict) -FreezeEntityPosition(ped, false) -end - function EcstasyEffect() local startStamina = 50 SetFlash(0, 0, 500, 20000, 500) @@ -204,111 +88,6 @@ function AlienEffect() StopScreenEffect("DrugsMichaelAliensFightOut") end -local hit = 0 -function SpawnCarPedChase() - ps.debug("SpawnCarPedChase") - local stoploc = vector3(-1157.63, -3056.71, 13.94) - local start = GlobalState.MDDrugsLocs.StartLoc[math.random(1,#GlobalState.MDDrugsLocs.StartLoc)] - if started then - ps.notify(Lang.lean.act,'error') - else - started = true - 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) - FreezeEntityPosition(pilot2, true) - SetEntityInvincible(pilot2, true) - SetEntityAsMissionEntity(leancar) - AddBlipForEntity(leancar) - SetPedIntoVehicle(driver, leancar, -1) - SetPedFleeAttributes(driver,false) - TaskVehicleDriveToCoordLongrange(driver, leancar, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0) - SetPedKeepTask(driver, true) - repeat - Wait(1000) - until #(GetEntityCoords(driver) - stoploc) < 20.0 or GetEntityHealth(driver) == 0 - RemoveBlip(leancar) - if GetEntityHealth(driver) == 0 then - ps.entityTarget(leancar, { - { - name = 'leancar', - icon = 'fa-solid fa-car', - label = Lang.targets.lean.st, - action = function() - hit = hit + 1 - if not minigame() then return end - TriggerServerEvent('md-drugs:server:givelean') - started = nil - if math.random(1,100) <= 30 or hit == 4 then - hit = 0 - DeleteVehicle(leancar) - DeleteEntity(driver) - DeleteEntity(pilot2) - end - end - } - }) - else - DeleteVehicle(leancar) DeleteEntity(driver) DeleteEntity(pilot2) - end -end -end - -function SpawnMethCarPedChase() -local ped = GetEntityCoords(PlayerPedId()) -local stoploc = vector3(-1157.63, -3056.71, 13.94) -local config = ps.callback('md-drugs:server:getLocs', false) -local start = config.StartLoc[math.random(1,#config.StartLoc)] -local startedmeth = false - -if startedmeth then - ps.notify(Lang.meth.act,'error') -else - startedmeth = true - 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) - FreezeEntityPosition(methpilot, true) - SetEntityInvincible(methpilot, true) - SetEntityAsMissionEntity(methcar) - AddBlipForEntity(methcar) - SetPedIntoVehicle(methdriver, methcar, -1) - SetPedFleeAttributes(methdriver,false) - TaskVehicleDriveToCoordLongrange(methdriver, methcar, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0) - SetPedKeepTask(methdriver, true) - repeat - Wait(1000) - until #(GetEntityCoords(methdriver) - stoploc) < 20.0 or GetEntityHealth(methdriver) == 0 - if GetEntityHealth(methdriver) == 0 then - AddSingleModel(methcar,{ - name = 'methcar', - icon = 'fa-solid fa-car', - label = Lang.targets.meth.stealfromcar, - action = function() - if not minigame() then return end - TriggerServerEvent('md-drugs:server:givemethingridients') - startedmeth = false - if math.random(1,100) <= 30 then - DeleteVehicle(methcar) - DeleteEntity(methdriver) - DeleteEntity(methpilot) - end - end, - }, nil ) - else - DeleteVehicle(methcar) - DeleteEntity(methdriver) - DeleteEntity(methpilot) - end -end -end - function SetUpPeds() AddRelationshipGroup('setups') local ped = GetEntityCoords(PlayerPedId()) diff --git a/client/cocaine.lua b/client/cocaine.lua index 6859ed6..7986e29 100644 --- a/client/cocaine.lua +++ b/client/cocaine.lua @@ -2,6 +2,115 @@ local cuttingcoke = nil local baggingcoke = nil +local function CutCoke(coords, offset, rotation) + local animDict, animName = "anim@amb@business@coc@coc_unpack_cut_left@", "coke_cut_v5_coccutter" + 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 + local scenes = { + { + { hash = "bkr_prop_coke_bakingsoda_o", animName = "coke_cut_v5_bakingsoda"}, + { hash = "prop_cs_credit_card", animName = "coke_cut_v5_creditcard"}, + { hash = "prop_cs_credit_card", animName = "coke_cut_v5_creditcard^1"} + }, +} + local scenesList, entitiesList = {}, {} + for i=1, #scenes, 1 do + local scene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) + NetworkAddPedToSynchronisedScene(ped, scene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) + for j=1, #scenes[i], 1 do + local s = scenes[i][j] + RequestModel(s.hash) + while not HasModelLoaded(s.hash) do + Wait(0) + end + local obj = CreateObjectNoOffset(s.hash, coords, true, true, true) + SetModelAsNoLongerNeeded(s.hash) + entitiesList[#entitiesList+1] = obj + NetworkAddEntityToSynchronisedScene(obj, scene, animDict, s.animName, 4.0, -8.0, 1) + end + scenesList[#scenesList+1] = scene + end + DisableCamCollisionForEntity(ped) + FreezeEntityPosition(ped, true) + for i=1, #scenesList, 1 do + NetworkStartSynchronisedScene(scenesList[i]) + end + + Wait(animDuration-11000) + for i=1, #scenesList, 1 do + NetworkStopSynchronisedScene(scenesList[i]) + end + for i=1, #entitiesList, 1 do + DeleteEntity(entitiesList[i]) + end + RemoveAnimDict(animDict) + FreezeEntityPosition(ped, false) +end + +local function BagCoke(coords, offset, rotation) + local ver = "" + local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01" + 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 + local scenes = { + { + { hash = "bkr_prop_coke_cutblock_01", animName = "break_weigh_"..ver.."box01"}, + { hash = "bkr_prop_coke_fullmetalbowl_02", animName = "break_weigh_"..ver.."box01^1"}, + { hash = "bkr_prop_coke_cutblock_01", animName = "break_weigh_"..ver.."methbag01"} + }, + { + { hash = "xm3_prop_xm3_bag_coke_01a", animName = "break_weigh_"..ver.."methbag01^1"}, + { hash = "xm3_prop_xm3_bag_coke_01a", animName = "break_weigh_"..ver.."methbag01^2"}, + { hash = "xm3_prop_xm3_bag_coke_01a", animName = "break_weigh_"..ver.."methbag01^3"} + }, + { + { hash = "bkr_prop_coke_fullscoop_01a", animName = "break_weigh_"..ver.."scoop"}, + { hash = "bkr_prop_coke_scale_01", animName = "break_weigh_"..ver.."scale"}, + { hash = "bkr_prop_fakeid_penclipboard", animName = "break_weigh_"..ver.."pen"} + }, + { + { hash = "bkr_prop_fakeid_clipboard_01a", animName = "break_weigh_"..ver.."clipboard"}, + + } + } + local scenesList, entitiesList = {}, {} + for i=1, #scenes, 1 do + local scene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) + NetworkAddPedToSynchronisedScene(ped, scene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) + for j=1, #scenes[i], 1 do + local s = scenes[i][j] + RequestModel(s.hash) + while not HasModelLoaded(s.hash) do + Wait(0) + end + local obj = CreateObjectNoOffset(s.hash, coords, true, true, true) + SetModelAsNoLongerNeeded(s.hash) + entitiesList[#entitiesList+1] = obj + NetworkAddEntityToSynchronisedScene(obj, scene, animDict, s.animName, 4.0, -8.0, 1) + end + scenesList[#scenesList+1] = scene + end + DisableCamCollisionForEntity(ped) + FreezeEntityPosition(ped, true) + for i=1, #scenesList, 1 do + NetworkStartSynchronisedScene(scenesList[i]) + end + + Wait(animDuration-11000) + for i=1, #scenesList, 1 do + NetworkStopSynchronisedScene(scenesList[i]) + end + for i=1, #entitiesList, 1 do + DeleteEntity(entitiesList[i]) + end + RemoveAnimDict(animDict) + FreezeEntityPosition(ped, false) +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}, { { @@ -54,4 +163,11 @@ for k, v in pairs (GlobalState.MDDrugsLocs.BaggingCoke) do end } }) -end \ No newline at end of file +end + +CreateThread(function() + BikerCocaine = exports['bob74_ipl']:GetBikerCocaineObject() + BikerCocaine.Style.Set(BikerCocaine.Style.upgrade) + BikerCocaine.Security.Set(BikerCocaine.Security.upgrade) + BikerCocaine.Details.Enable({BikerCocaine.Details.cokeBasic1, BikerCocaine.Details.cokeBasic2, BikerCocaine.Details.cokeBasic3}, true) +end) diff --git a/client/cornerselling.lua b/client/cornerselling.lua index 0f03a89..e97ff43 100644 --- a/client/cornerselling.lua +++ b/client/cornerselling.lua @@ -76,7 +76,7 @@ local function checkItems() return true end -function Cornersell() +local function Cornersell() if inZone then sell = false return end if not sell then diff --git a/client/lean.lua b/client/lean.lua index a61a135..f47a2d8 100644 --- a/client/lean.lua +++ b/client/lean.lua @@ -2,11 +2,13 @@ local started = false local hit = 0 -function SpawnCarPedChase() +local function SpawnCarPedChase() local stoploc = vector3(-1157.63, -3056.71, 13.94) local start = GlobalState.MDDrugsLocs.StartLoc[math.random(1,#GlobalState.MDDrugsLocs.StartLoc)] + if started then ps.notify(Lang.lean.act,'error') return end started = true + ps.callback('md-drugs:server:RegisterLean') ps.requestModel("pounder", Config.RequestModelTime) ps.requestModel("ig_priest", Config.RequestModelTime) diff --git a/client/meth.lua b/client/meth.lua index c20d164..7d847db 100644 --- a/client/meth.lua +++ b/client/meth.lua @@ -3,6 +3,86 @@ local tray = false local heated = false local active = false local trays = nil + +--- meth heist +local startedmeth = false + +local function SpawnMethCarPedChase() + local stoploc = vector3(-1157.63, -3056.71, 13.94) + local start = GlobalState.MDDrugsLocs.StartLoc[math.random(1,#GlobalState.MDDrugsLocs.StartLoc)] + if startedmeth then + ps.notify(ps.lang('meth.act'),'error') + else + startedmeth = true + ps.callback('md-drugs:server:RegisterMeth') + + 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) + + FreezeEntityPosition(methpilot, true) + SetEntityInvincible(methpilot, true) + SetEntityAsMissionEntity(methcar) + AddBlipForEntity(methcar) + SetPedIntoVehicle(methdriver, methcar, -1) + SetPedFleeAttributes(methdriver,false) + TaskVehicleDriveToCoordLongrange(methdriver, methcar, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0) + SetPedKeepTask(methdriver, true) + + repeat + Wait(1000) + until #(GetEntityCoords(methdriver) - stoploc) < 20.0 or GetEntityHealth(methdriver) == 0 + + if GetEntityHealth(methdriver) == 0 then + ps.entityTarget(methcar, { + { + name = 'methcar', + icon = 'fa-solid fa-car', + label = Lang.targets.meth.stealfromcar, + action = function() + if not minigame() then return end + TriggerServerEvent('md-drugs:server:givemethingridients') + startedmeth = false + if math.random(1,100) <= 30 then + DeleteVehicle(methcar) + DeleteEntity(methdriver) + DeleteEntity(methpilot) + end + end, + } + }) + else + DeleteVehicle(methcar) + DeleteEntity(methdriver) + DeleteEntity(methpilot) + end + end +end + +local peds = {} +for k, v in pairs (GlobalState.MDDrugsLocs.MethHeist) do + peds[k] = CreatePed(4, GetHashKey(v.ped), v.loc.x, v.loc.y, v.loc.z, v.loc.w, false, true) + Freeze(peds[k], true, v.loc.w) + ps.entityTarget(peds[k], { + { + name = 'methheist'..k, + icon = 'fa-solid fa-user-secret', + label = ps.lang('targets.meth.heist'), + action = function() + if startedmeth then ps.notify(ps.lang('meth.act'),'error') return end + SpawnMethCarPedChase() + end, + canInteract = function() + return handleGang(v.gang) + end + } + }) +end + ---- start animation shit local function loadParticle(dict) if not HasNamedPtfxAssetLoaded(dict) then diff --git a/client/oxyruns.lua b/client/oxyruns.lua index 1661fa8..3eb8391 100644 --- a/client/oxyruns.lua +++ b/client/oxyruns.lua @@ -1,74 +1,90 @@ local carryPackage = nil +local onMission = false -RegisterNetEvent("md-drugs:client:GetOxyCar", function() - lib.requestModel("burrito3", Config.RequestModelTime) - local paid = ps.callback('md-drugs:server:payfortruck', false) - if not paid then return end - local loca = ps.callback('md-drugs:server:getLocs', false) - local loc = loca.singleSpot.truckspawn - local oxycar = CreateVehicle("burrito3",loc.x, loc.y,loc.z, loc.w, true, false) - exports[Config.Fuel]:SetFuel(oxycar, 100.0) - TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(oxycar)) - ps.notify(Lang.oxy.truck, 'success') - TriggerEvent("md-drugs:client:getoxylocationroute") - AddSingleModel(oxycar, { event = "md-drugs:client:getfromtrunk", icon = "fa-solid fa-box", label = Lang.targets.oxy.pack}, nil ) -end) +local function getRoute() + local Route = ps.callback('md-drugs:server:getRoute') + if not Route then + ps.notify(ps.lang('oxy.done'), "success") + onMission = false + return false + end -RegisterNetEvent("md-drugs:client:getoxylocationroute", function() - local config = ps.callback('md-drugs:server:getLocs', false) - local loc = config.oxylocations[math.random(#config.oxylocations)] - if loc ~= nil then - SetNewWaypoint(loc.x, loc.y) - local current = "g_m_y_famdnf_01" - lib.requestModel(current, Config.RequestModelTime) - local oxybuyer = CreatePed(0, current,loc.x,loc.y,loc.z-1, loc.w, false, false) - Freeze(oxybuyer, true, loc.w) - repeat - Wait(1000) - until #(GetEntityCoords(PlayerPedId()) - vector3(loc.x,loc.y,loc.z)) < 5.0 - PoliceCall(Config.PoliceAlertOxy) - AddSingleModel(oxybuyer, { type = "client", label = Lang.targets.oxy.talk, icon = "fa-solid fa-dollar-sign", - action = function() - if carryPackage then - if not ps.progressbar(Lang.oxy.hand, 4000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:giveoxybox") - DeleteEntity(oxybuyer) - DetachEntity(carryPackage, true, true) - DeleteObject(carryPackage) - carryPackage = nil - else - ps.notify(Lang.oxy.empty, "error") + SetNewWaypoint(Route.x, Route.y) + ps.requestModel('g_m_y_famdnf_01', Config.RequestModelTime) + local oxybuyer = CreatePed(0, 'g_m_y_famdnf_01',Route.x,Route.y,Route.z-1, Route.w, false, false) + Freeze(oxybuyer, true, Route.w) + local timeOut = 300 + + repeat + Wait(1000) + timeOut = timeOut - 1 + until #(GetEntityCoords(PlayerPedId()) - vector3(Route.x,Route.y,Route.z)) < 5.0 or timeOut == 0 + + PoliceCall(Config.PoliceAlertOxy) + ps.entityTarget(oxybuyer,{ + { + label = ps.lang('targets.oxy.talk'), + icon = "fa-solid fa-dollar-sign", + action = function() + if carryPackage then + if not ps.progressbar(ps.lang('oxy.hand'), 4000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:giveoxybox") + DeleteEntity(oxybuyer) + DetachEntity(carryPackage, true, true) + DeleteObject(carryPackage) + carryPackage = nil + getRoute() + else + ps.notify(ps.lang('oxy.empty'), "error") + end end - end}, oxybuyer) - end -end) + } + }) +end +for k, v in pairs(GlobalState.MDDrugsLocs.OxyPayForTruck) do + ps.boxTarget('oxyTruckPur' ..k , v.loc, {length = v.l, width = v.w, heading = v.rot}, { + { + icon = 'fa-solid fa-truck-fast', + label = ps.lang('targets.oxy.buytruck'), + action = function() + ps.requestModel("burrito3", Config.RequestModelTime) -RegisterNetEvent("md-drugs:client:getfromtrunk", function() - if carryPackage then - ps.notify(Lang.oxy.cantcarry, "error") - else - local pos = GetEntityCoords(PlayerPedId(), true) - lib.requestAnimDict('anim@heists@box_carry@') - TaskPlayAnim(PlayerPedId(), 'anim@heists@box_carry@', 'idle', 5.0, -1, -1, 50, 0, false, false, false) - lib.RequestModel("hei_prop_drug_statue_box_big") - local object = CreateObject("hei_prop_drug_statue_box_big", pos.x, pos.y, pos.z, true, true, true) - AttachEntityToEntity(object, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 57005), 0.05, 0.1, -0.3, 300.0, 250.0, 20.0, true, true, false, true, 1, true) - carryPackage = object - end -end) + local paid = ps.callback('md-drugs:server:payfortruck', false) + if not paid then return end + local oxycar = CreateVehicle("burrito3",v.truckSpawn.x, v.truckSpawn.y, v.truckSpawn.z, v.truckSpawn.w, true, false) + exports[Config.Fuel]:SetFuel(oxycar, 100.0) + TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(oxycar)) + ps.notify(ps.lang('oxy.truck'), 'success') + onMission = true + getRoute() -RegisterNetEvent("md-drugs:client:giveoxybox", function(data) - if carryPackage then - if not ps.progressbar(Lang.oxy.hand, 4000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:giveoxybox") - DeleteEntity(data.ped) - DetachEntity(carryPackage, true, true) - DeleteObject(carryPackage) - carryPackage = nil - else - ps.notify(Lang.oxy.empty, "error") - end -end) - + ps.entityTarget(oxycar, { + { + icon = "fa-solid fa-box", + label = ps.lang('targets.oxy.pack'), + action = function() + if carryPackage then + ps.notify(ps.lang('oxy.cantcarry'), "error") + else + local pos = GetEntityCoords(PlayerPedId(), true) + ps.requestAnim('anim@heists@box_carry@') + TaskPlayAnim(PlayerPedId(), 'anim@heists@box_carry@', 'idle', 5.0, -1, -1, 50, 0, false, false, false) + ps.requestModel("hei_prop_drug_statue_box_big") + carryPackage = CreateObject("hei_prop_drug_statue_box_big", pos.x, pos.y, pos.z, true, true, true) + AttachEntityToEntity(carryPackage, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 57005), 0.05, 0.1, -0.3, 300.0, 250.0, 20.0, true, true, false, true, 1, true) + end + end, + } + }) + end, + canInteract = function() + if onMission then + return false + end + return true + end + } + }) +end \ No newline at end of file diff --git a/client/pharma.lua b/client/pharma.lua index 7650c5e..9de6785 100644 --- a/client/pharma.lua +++ b/client/pharma.lua @@ -1,20 +1,35 @@ ps.registerCallback("md-drugs:client:prescriptionpad", function(data, op) if ps.getJobType() ~= 'ems' then return end - local input = lib.inputDialog('Who To Give A Prescription To?',{ - {type = 'select', label = 'Player Name', options = data}, - {type = 'select', label = 'Prescription', options = op}}) + local input = exports.ps_lib:input('Who To Give A Prescription To?',{ + {type = 'select', title = 'Player Name', options = data}, + {type = 'select', title = 'Prescription', options = op} + }) if not input[1] then return end - if not ps.progressbar(Lang.Pharma.write, 4000, 'notepad') then return end - return {who = input[1], what = input[2]} + if not ps.progressbar(ps.lang('Pharma.write'), 4000, 'notepad') then return end + return {who = input[1], what = input[2]} end) RegisterNetEvent("md-drugs:client:fillprescription", function(data) - if not ps.progressbar(Lang.Pharma.fill, 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('Pharma.fill'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:fillprescription", data.data) end) ps.registerCallback("md-drugs:client:unbottle", function() - if not ps.progressbar(Lang.Pharma.open, 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('Pharma.open'), 4000, 'uncuff') then return end return true end) + + +for k, v in pairs (GlobalState.MDDrugsLocs.FillPrescription) do + ps.boxTarget('pharma' ..k , v.loc, {length = v.l, width = v.w, heading = v.rot}, { + { + icon = 'fa-solid fa-capsules', + label = ps.lang('Pharma.fillprescription'), + action = function() + if not ps.progressbar(ps.lang('Pharma.fill'), 4000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:fillprescription", k) + end + } + }) +end \ No newline at end of file diff --git a/server/locations.lua b/server/locations.lua index 3083dae..66e8e96 100644 --- a/server/locations.lua +++ b/server/locations.lua @@ -89,9 +89,15 @@ local Target = { Methace = { -- get acetone {loc = vector3(3535.41, 3661.05, 28.12), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, }, + MethHeist = { + {loc = vector4(-1520.84, 827.72, 181.66, 184.13), ped = 'a_m_m_farmer_01', gang = ""}, + }, SyrupVendor = { {ped = 'a_m_m_farmer_01', loc = vector4(365.21, -578.77, 39.30, 347.23), l = 1.0, w = 1.0, rot = 347.23, gang = ""}, }, + OxyPayForTruck = { + {loc = vector3(1437.64, -1491.91, 63.62), truckSpawn = vector4(1450.87, -1482.13, 63.22, 69.95), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, + }, singleSpot = { CokeTeleIn = vector3(198.16, -1276.92, 29.33), -- where you target to go inside coke CokeTeleOut = vector3(1088.81, -3187.57, -38.99), -- where you target to leave coke diff --git a/server/meth.lua b/server/meth.lua index a1875b2..79cb2b9 100644 --- a/server/meth.lua +++ b/server/meth.lua @@ -1,6 +1,6 @@ local onRun = {} - +local cool = {} local function setTimeout(identifier) if onRun[identifier] then CreateThread(function() @@ -10,6 +10,19 @@ local function setTimeout(identifier) end end +local function coolDown(identifier) + if cool[identifier] then + return false + else + cool[identifier] = true + CreateThread(function() + Wait(3500) + cool[identifier] = nil + end) + return true + end +end + RegisterServerEvent('md-drugs:server:givemethingridients', function() local src = source local amount = math.random(1,5) @@ -38,17 +51,19 @@ end) RegisterServerEvent('md-drugs:server:geteph', function(num) local src = source - if not checkLoc(src, 'MethEph', num) then return end - if AddItem(src, 'ephedrine', 1) then + if not ps.checkDistance(src, GlobalState.MDDrugsLocs.MethEph[num].loc, 2.5) then return end + if not coolDown(ps.getIdentifier(src)) then return ps.notify(src, ps.lang('meth.wait'), "error") end + if ps.addItem(src, 'ephedrine', 1) then ps.notify(src, 'Got Ephedrine!', "success") end end) - + RegisterServerEvent('md-drugs:server:getace', function(num) local src = source - if not checkLoc(src, 'Methace', num) then return end - if AddItem(src, 'acetone', 1) then - --Log(GetName(src) .. ' Got ' .. 1 .. 'Of Acetone', 'Meth') + if not ps.checkDistance(src, GlobalState.MDDrugsLocs.MethAce[num].loc, 2.5) then return end + if not coolDown(ps.getIdentifier(src)) then return ps.notify(src, ps.lang('meth.wait'), "error") end + if ps.addItem(src, 'acetone', 1) then + ps.notify(src, 'Got Acetone!', "success") end end) @@ -56,6 +71,17 @@ ps.registerCallback('md-drugs:server:startcook', function(source, num) local src = source if not ps.checkDistance(src, GlobalState.MDDrugsLocs.CookMeth[num].loc, 2.5) then return false end local recipe = GetRecipe(src, 'meth', 'cook', 'heat') - ps.debug(recipe) return recipe -end) \ No newline at end of file +end) + +ps.registerCallback('md-drugs:server:registerMeth', function(source) + local identifier = ps.getIdentifier(source) + if not identifier then return false end + if onRun[identifier] then + return false + else + onRun[identifier] = 0 + setTimeout(identifier) + return true + end +end) diff --git a/server/oxyruns.lua b/server/oxyruns.lua index 82a77d3..165ff9d 100644 --- a/server/oxyruns.lua +++ b/server/oxyruns.lua @@ -1,17 +1,17 @@ -QBCore = exports['qb-core']:GetCoreObject() local prices = { payfortruck = 500, hotchance = 30, itemChance = 20, } -ps.registerCallback('md-drugs:server:payfortruck', function() +local onRoute = {} +ps.registerCallback('md-drugs:server:payfortruck', function(source) local src = source - local Player = getPlayer(src) - if Player.Functions.RemoveMoney('cash', prices.payfortruck) or Player.Functions.RemoveMoney('bank', prices.payfortruck) then - --Log(GetName(src) .. ' Rented A Van For OxyRuns', 'oxy') + if ps.removeMoney(src, 'cash', prices.payfortruck) or ps.removeMoney(src, 'bank', prices.payfortruck) then + onRoute[src] = true + ps.notify(src, ps.lang('oxy.paid') .. prices.payfortruck, "success") return true else - ps.notify(src, Lang.oxy.broke, "error") + ps.notify(src, ps.lang('oxy.broke'), "error") return false end end) @@ -19,29 +19,38 @@ end) RegisterServerEvent('md-drugs:server:giveoxybox', function() local src = source - local Player = getPlayer(src) - local chance = math.random(1,100) - local cash = 200 + if not onRoute[src] then + ps.notify(src, ps.lang('oxy.notonroute'), "error") + return + end + + if not ps.checkDistance(src, GlobalState.MDDrugsLocs.oxylocations[onRoute[src]], 3.5) then + ps.notify(src, ps.lang('oxy.toofar'), "error") + return + end + + local cash = math.random(50, 200) local itemchance = math.random(1,100) local itemList = { {item = 'oxy', amount = 2}, {item = 'houselockpick', amount = 1}, } local item = itemList[math.random(1, #itemList)] - if chance <= prices.hotchance then - ps.notify(src, Lang.oxy.hot, "error") - Player.Functions.AddMoney("cash", cash * 0.5) - if itemchance <= prices.itemChance then - AddItem(src, item.item, item.amount) - end - else - ps.notify(Lang.oxy.next, "success") - TriggerClientEvent("md-drugs:client:getoxylocationroute", src) - Player.Functions.AddMoney("cash", cash) - if itemchance <= prices.itemChance then - AddItem(src, item.item, item.amount) - end + ps.addMoney(src,"cash", cash) + if itemchance <= prices.itemChance then + ps.addItem(src, item.item, item.amount) + end +end) + +ps.registerCallback('md-drugs:server:getRoute', function(source) + if not onRoute[source] then return false end + local giveLocation = math.random(1, 10) + if giveLocation == 10 then + onRoute[source] = nil + return false + else + onRoute[source] = math.random(1, #GlobalState.MDDrugsLocs.oxylocations) + return GlobalState.MDDrugsLocs.oxylocations[onRoute[source]] end - end) diff --git a/server/pharma.lua b/server/pharma.lua index f0f3454..c08a08d 100644 --- a/server/pharma.lua +++ b/server/pharma.lua @@ -1,75 +1,67 @@ local QBCore = exports['qb-core']:GetCoreObject() -local function GetJob(source) +local function GetJob(source) local src = source - local Player = getPlayer(src) - if Player.PlayerData.job.type == 'ems' then - return true - else - ps.notify(src, 'You Must Be EMS To Do This', 'error') - return false - end + return ps.getJobType(src) == 'ems' end -CUI('prescription_pad', function(source, item) +ps.createUseable('prescription_pad', function(source, item) local src = source local near = {} - if GetJob(src) then - for k, v in pairs (QBCore.Functions.GetQBPlayers()) do - local targ = QBCore.Functions.GetPlayerByCitizenId(v.PlayerData.citizenid) - local tname = GetName(v.PlayerData.source) - local ped, tped = GetPlayerPed(src), GetPlayerPed(v.PlayerData.source) - local dist = #(GetEntityCoords(ped) - GetEntityCoords(tped)) - if dist < 5.0 then - table.insert(near, {label = tname, value = targ.PlayerData.citizenid}) - end - end - local options = { {label = 'Vicodin', value = 'vicodin_prescription'}, {label = 'Adderal', value = 'adderal_prescription'}, {label = 'Morphine', value = 'morphine_prescription'},{label = 'Xanax', value = 'xanax_prescription'}} + if GetJob(src) then + local near = ps.getNearbyPlayers(src, 5.0) + + local options = { + {label = 'Vicodin', value = 'vicodin_prescription'}, + {label = 'Adderal', value = 'adderal_prescription'}, + {label = 'Morphine', value = 'morphine_prescription'}, + {label = 'Xanax', value = 'xanax_prescription'} + } local data = ps.callback('md-drugs:client:prescriptionpad', src, near, options) - if type(data) == 'table' then - local give = QBCore.Functions.GetPlayerByCitizenId(data.who) - for i = 1, #options do - if data.what == options[i].value then - AddItem(give.PlayerData.source, data.what, 1) - end - end - end + if not data then return ps.notify(src, ps.lang('Pharma.cancel'), "error") end + ps.addItem(ps.getSource(data.who), data.what, 1) end end) local pharmabottle = {'vicodinbottle', 'adderalbottle','morphinebottle','xanaxbottle'} for m, d in pairs (pharmabottle) do -CUI(d, function(source, item) - local src = source - local Player = getPlayer(src) - local check = ps.callback("md-drugs:client:unbottle", src) - if check then - local get = { - ['vicodinbottle'] = 'vicodin', - ['adderalbottle'] = 'adderal', - ['morphinebottle'] = 'morphine', - ['xanaxbottle'] = 'xanax' - } - for k, v in pairs (get) do - if d == k then - RemoveItem(src, d, 1) - AddItem(src, v, math.random(10,30)) - ps.notify(src,Lang.Pharma.unbottle, "success") - --Log(GetName(src) .. ' Unbottled 30 Of ' .. v .. '!', 'pharma') + ps.createUseable(d, function(source, item) + local src = source + local check = ps.callback("md-drugs:client:unbottle", src) + if check then + local get = { + ['vicodinbottle'] = 'vicodin', + ['adderalbottle'] = 'adderal', + ['morphinebottle'] = 'morphine', + ['xanaxbottle'] = 'xanax' + } + for k, v in pairs (get) do + if d == k then + ps.removeItem(src, d, 1) + ps.addItem(src, v, math.random(10,30)) + ps.notify(src,ps.lang('Pharma.unbottle'), "success") + --Log(GetName(src) .. ' Unbottled 30 Of ' .. v .. '!', 'pharma') + end end end - end -end) + end) end -RegisterServerEvent('md-drugs:server:fillprescription', function() +RegisterServerEvent('md-drugs:server:fillprescription', function(num) local src = source - local Player = getPlayer(src) - local pres = {vicodin_prescription = 'vicodinbottle', adderal_prescription = 'adderalbottle', morphine_prescription = 'morphinebottle', xanax_prescription = 'xanaxbottle'} + if not ps.checkDistance(src, GlobalState.MDDrugsLocs.FillPrescription[num].loc, 3.5) then + return ps.notify(src, ps.lang('Pharma.toofar'), "error") + end + local pres = { + vicodin_prescription = 'vicodinbottle', + adderal_prescription = 'adderalbottle', + morphine_prescription = 'morphinebottle', + xanax_prescription = 'xanaxbottle' + } for k, v in pairs (pres) do - if Player.Functions.GetItemByName(k) then - RemoveItem(src, k, 1 ) - AddItem(src,v, 1) + if ps.hasItem(src, k, 1) then + ps.removeItem(src, k, 1) + ps.addItem(src, v, 1) break end end diff --git a/shared/config.lua b/shared/config.lua index a1b66cb..58df3b2 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -61,8 +61,8 @@ Config.Drugs = { lsd = true, mescaline = true, meth = true, - oxyruns = false, - pharma = false, + oxyruns = true, + pharma = true, shrooms = true, weed = true, wholesale = false,