Files
md-drugs/client/oxyruns.lua
T

100 lines
3.1 KiB
Lua
Raw Normal View History

2024-01-13 22:23:17 -08:00
local carryPackage = nil
2025-07-18 01:19:12 -07:00
local onMission = false
2025-08-06 02:25:06 -06:00
local locations = ps.callback('md-drugs:server:GetOxyLocs')
2025-09-05 21:28:04 -07:00
local pdAlert = 90
2025-08-09 03:10:00 -06:00
2025-07-18 01:19:12 -07:00
local function getRoute()
local Route = ps.callback('md-drugs:server:getRoute')
if not Route then
2025-08-09 03:10:00 -06:00
ps.notify(ps.lang('oxy.ditchCar'), "error")
2025-07-18 01:19:12 -07:00
onMission = false
return false
2024-01-13 22:23:17 -08:00
end
2025-07-18 01:19:12 -07:00
SetNewWaypoint(Route.x, Route.y)
2025-09-05 21:28:04 -07:00
ps.requestModel('g_m_y_famdnf_01', 30000)
2025-07-18 01:19:12 -07:00
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
2024-01-13 22:23:17 -08:00
2025-07-18 01:19:12 -07:00
repeat
Wait(1000)
timeOut = timeOut - 1
until #(GetEntityCoords(PlayerPedId()) - vector3(Route.x,Route.y,Route.z)) < 5.0 or timeOut == 0
2025-09-05 21:28:04 -07:00
PoliceCall(pdAlert)
2025-07-18 01:19:12 -07:00
ps.entityTarget(oxybuyer,{
{
2025-08-09 03:10:00 -06:00
label = ps.lang('oxy.targetHandoff'),
2025-07-18 01:19:12 -07:00
icon = "fa-solid fa-dollar-sign",
action = function()
if carryPackage then
2025-08-09 03:10:00 -06:00
if not ps.progressbar(ps.lang('oxy.handingoff'), 4000, 'uncuff') then return end
2025-07-18 01:19:12 -07:00
TriggerServerEvent("md-drugs:server:giveoxybox")
DeleteEntity(oxybuyer)
DetachEntity(carryPackage, true, true)
DeleteObject(carryPackage)
carryPackage = nil
getRoute()
else
2025-08-09 03:10:00 -06:00
ps.notify(ps.lang('oxy.emptyHands'), "error")
2025-07-18 01:19:12 -07:00
end
end
}
})
end
2024-01-13 22:23:17 -08:00
2025-08-06 02:25:06 -06:00
for k, v in pairs(locations.OxyPayForTruck) do
2025-07-18 01:19:12 -07:00
ps.boxTarget('oxyTruckPur' ..k , v.loc, {length = v.l, width = v.w, heading = v.rot}, {
{
icon = 'fa-solid fa-truck-fast',
2025-08-09 03:10:00 -06:00
label = ps.lang('oxy.targetPay'),
2025-07-18 01:19:12 -07:00
action = function()
2025-09-05 21:28:04 -07:00
ps.requestModel("burrito3", 30000)
2024-05-02 18:34:14 -07:00
2025-07-18 01:19:12 -07:00
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)
2024-01-13 22:23:17 -08:00
2025-08-12 23:16:38 -05:00
if Config.Fuel == "ox_fuel" then
Entity(oxycar).state.fuel = 100.0
else
exports[Config.Fuel]:SetFuel(oxycar, 100.0)
end
2025-07-18 01:19:12 -07:00
TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(oxycar))
2025-08-09 03:10:00 -06:00
ps.notify(ps.lang('oxy.keys'), 'success')
2025-07-18 01:19:12 -07:00
onMission = true
getRoute()
ps.entityTarget(oxycar, {
{
icon = "fa-solid fa-box",
2025-08-09 03:10:00 -06:00
label = ps.lang('oxy.targetGetPackage'),
2025-07-18 01:19:12 -07:00
action = function()
if carryPackage then
2025-08-09 03:10:00 -06:00
ps.notify(ps.lang('oxy.alreadyCarrying'), "error")
2025-07-18 01:19:12 -07:00
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,
2025-08-09 03:10:00 -06:00
canInteract = function()
return handleGang(v.gang)
end
2025-07-18 01:19:12 -07:00
}
})
end,
canInteract = function()
if onMission then
return false
end
return true
end
}
})
2025-08-12 23:16:38 -05:00
end