Files
md-drugs/client/lean.lua
T

82 lines
2.4 KiB
Lua
Raw Normal View History

2025-07-17 02:06:17 -05:00
local started = false
local hit = 0
2025-08-06 02:25:06 -06:00
local location = ps.callback('md-drugs:server:GetLeanLocs')
2025-08-09 23:58:38 -06:00
2025-07-18 01:19:12 -07:00
local function SpawnCarPedChase()
2025-07-17 02:06:17 -05:00
local stoploc = vector3(-1157.63, -3056.71, 13.94)
2025-08-06 02:25:06 -06:00
local start = location.StartLoc[math.random(1,#location.StartLoc)]
2025-07-18 01:19:12 -07:00
2025-08-09 23:58:38 -06:00
if started then ps.notify(ps.lang('lean.alreadyChasing'), 'error') return end
2025-07-17 02:06:17 -05:00
started = true
2025-07-18 01:19:12 -07:00
2025-07-17 02:06:17 -05:00
ps.callback('md-drugs:server:RegisterLean')
2025-09-05 21:28:04 -07:00
ps.requestModel("pounder", 30000)
ps.requestModel("ig_priest", 30000)
ps.requestModel("cargobob3", 30000)
2025-07-17 02:06:17 -05:00
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',
2025-08-09 03:10:00 -06:00
label = ps.lang('lean.stealFromTruck'),
2025-07-17 02:06:17 -05:00
action = function()
hit = hit + 1
2025-08-09 23:58:38 -06:00
if not minigame() then return end
TriggerServerEvent('md-drugs:server:givelean')
started = false
if math.random(1,100) <= 30 or hit == 4 then
hit = 0
DeleteVehicle(leancar)
DeleteEntity(driver)
DeleteEntity(pilot2)
end
2025-07-17 02:06:17 -05:00
end
}
})
else
DeleteVehicle(leancar)
DeleteEntity(driver)
DeleteEntity(pilot2)
end
end
2025-07-17 02:06:17 -05:00
local leanPeds = {}
2025-08-06 02:25:06 -06:00
for k, v in pairs (location.SyrupVendor) do
2025-07-17 02:06:17 -05:00
ps.requestModel(v.ped)
leanPeds[k] = CreatePed(0, v.ped, v.loc.x, v.loc.y, v.loc.z, false, false)
Freeze(leanPeds[k], true, v.loc.w)
ps.entityTarget(leanPeds[k], {
{
icon = "fa-solid fa-hand-holding-medical",
2025-08-09 03:10:00 -06:00
label = ps.lang('lean.startMission'),
2025-07-17 02:06:17 -05:00
action = function()
SpawnCarPedChase()
end,
2025-08-09 03:10:00 -06:00
canInteract = function()
if not handleGang(v.gang) then return false end
return true
end
2025-07-17 02:06:17 -05:00
},
})
end