2024-01-13 22:23:17 -08:00
|
|
|
local carryPackage = nil
|
|
|
|
|
|
2024-09-24 15:07:41 -07:00
|
|
|
RegisterNetEvent("md-drugs:client:GetOxyCar", function()
|
|
|
|
|
lib.requestModel("burrito3", Config.RequestModelTime)
|
2025-07-01 03:09:46 -07:00
|
|
|
local paid = ps.callback('md-drugs:server:payfortruck', false)
|
2024-09-24 15:07:41 -07:00
|
|
|
if not paid then return end
|
2025-07-01 03:09:46 -07:00
|
|
|
local loca = ps.callback('md-drugs:server:getLocs', false)
|
2024-11-24 01:25:09 -08:00
|
|
|
local loc = loca.singleSpot.truckspawn
|
|
|
|
|
local oxycar = CreateVehicle("burrito3",loc.x, loc.y,loc.z, loc.w, true, false)
|
2024-01-13 22:23:17 -08:00
|
|
|
exports[Config.Fuel]:SetFuel(oxycar, 100.0)
|
2024-12-12 15:26:48 -08:00
|
|
|
TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(oxycar))
|
2025-07-17 02:06:17 -05:00
|
|
|
ps.notify(Lang.oxy.truck, 'success')
|
2024-01-13 22:23:17 -08:00
|
|
|
TriggerEvent("md-drugs:client:getoxylocationroute")
|
2024-11-25 01:21:53 -08:00
|
|
|
AddSingleModel(oxycar, { event = "md-drugs:client:getfromtrunk", icon = "fa-solid fa-box", label = Lang.targets.oxy.pack}, nil )
|
2024-01-13 22:23:17 -08:00
|
|
|
end)
|
|
|
|
|
|
2024-11-12 01:04:42 -08:00
|
|
|
RegisterNetEvent("md-drugs:client:getoxylocationroute", function()
|
2025-07-01 03:09:46 -07:00
|
|
|
local config = ps.callback('md-drugs:server:getLocs', false)
|
2024-11-24 01:25:09 -08:00
|
|
|
local loc = config.oxylocations[math.random(#config.oxylocations)]
|
|
|
|
|
if loc ~= nil then
|
|
|
|
|
SetNewWaypoint(loc.x, loc.y)
|
2024-09-24 15:07:41 -07:00
|
|
|
local current = "g_m_y_famdnf_01"
|
|
|
|
|
lib.requestModel(current, Config.RequestModelTime)
|
2024-11-24 01:25:09 -08:00
|
|
|
local oxybuyer = CreatePed(0, current,loc.x,loc.y,loc.z-1, loc.w, false, false)
|
|
|
|
|
Freeze(oxybuyer, true, loc.w)
|
2024-09-24 15:07:41 -07:00
|
|
|
repeat
|
|
|
|
|
Wait(1000)
|
2024-11-24 01:25:09 -08:00
|
|
|
until #(GetEntityCoords(PlayerPedId()) - vector3(loc.x,loc.y,loc.z)) < 5.0
|
2024-10-23 17:44:46 -07:00
|
|
|
PoliceCall(Config.PoliceAlertOxy)
|
2024-11-25 01:21:53 -08:00
|
|
|
AddSingleModel(oxybuyer, { type = "client", label = Lang.targets.oxy.talk, icon = "fa-solid fa-dollar-sign",
|
2024-09-24 15:07:41 -07:00
|
|
|
action = function()
|
|
|
|
|
if carryPackage then
|
2025-07-17 02:06:17 -05:00
|
|
|
if not ps.progressbar(Lang.oxy.hand, 4000, 'uncuff') then return end
|
2024-09-24 15:07:41 -07:00
|
|
|
TriggerServerEvent("md-drugs:server:giveoxybox")
|
|
|
|
|
DeleteEntity(oxybuyer)
|
|
|
|
|
DetachEntity(carryPackage, true, true)
|
|
|
|
|
DeleteObject(carryPackage)
|
|
|
|
|
carryPackage = nil
|
|
|
|
|
else
|
2025-07-17 02:06:17 -05:00
|
|
|
ps.notify(Lang.oxy.empty, "error")
|
2024-09-24 15:07:41 -07:00
|
|
|
end
|
|
|
|
|
end}, oxybuyer)
|
2024-01-13 22:23:17 -08:00
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
2024-05-02 18:34:14 -07:00
|
|
|
RegisterNetEvent("md-drugs:client:getfromtrunk", function()
|
2024-01-13 22:23:17 -08:00
|
|
|
if carryPackage then
|
2025-07-17 02:06:17 -05:00
|
|
|
ps.notify(Lang.oxy.cantcarry, "error")
|
2024-11-24 01:25:09 -08:00
|
|
|
else
|
2024-05-02 18:34:14 -07:00
|
|
|
local pos = GetEntityCoords(PlayerPedId(), true)
|
2024-11-24 01:25:09 -08:00
|
|
|
lib.requestAnimDict('anim@heists@box_carry@')
|
2024-01-13 22:23:17 -08:00
|
|
|
TaskPlayAnim(PlayerPedId(), 'anim@heists@box_carry@', 'idle', 5.0, -1, -1, 50, 0, false, false, false)
|
2024-11-24 01:25:09 -08:00
|
|
|
lib.RequestModel("hei_prop_drug_statue_box_big")
|
2024-01-13 22:23:17 -08:00
|
|
|
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
|
2024-11-24 01:25:09 -08:00
|
|
|
end
|
2024-01-13 22:23:17 -08:00
|
|
|
end)
|
|
|
|
|
|
2024-05-02 18:34:14 -07:00
|
|
|
|
|
|
|
|
RegisterNetEvent("md-drugs:client:giveoxybox", function(data)
|
2024-01-13 22:23:17 -08:00
|
|
|
if carryPackage then
|
2025-07-17 02:06:17 -05:00
|
|
|
if not ps.progressbar(Lang.oxy.hand, 4000, 'uncuff') then return end
|
2024-05-02 18:34:14 -07:00
|
|
|
TriggerServerEvent("md-drugs:server:giveoxybox")
|
|
|
|
|
DeleteEntity(data.ped)
|
|
|
|
|
DetachEntity(carryPackage, true, true)
|
|
|
|
|
DeleteObject(carryPackage)
|
|
|
|
|
carryPackage = nil
|
2024-01-13 22:23:17 -08:00
|
|
|
else
|
2025-07-17 02:06:17 -05:00
|
|
|
ps.notify(Lang.oxy.empty, "error")
|
2024-01-13 22:23:17 -08:00
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|