Files
md-drugs/client/lean.lua
T

82 lines
2.5 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
2026-01-16 02:57:26 -07:00
if started then Bridge.Notify.SendNotify(Bridge.Language.Locale('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')
2026-01-18 01:20:44 -07:00
requestModel("pounder", 30000)
requestModel("ig_priest", 30000)
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
2026-01-18 01:20:44 -07:00
Bridge.Target.AddLocalEntity(leancar, {
2025-07-17 02:06:17 -05:00
{
name = 'leancar',
icon = 'fa-solid fa-car',
2026-01-16 02:57:26 -07:00
label = Bridge.Language.Locale('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
2026-01-18 01:20:44 -07:00
requestModel(v.ped)
2025-07-17 02:06:17 -05:00
leanPeds[k] = CreatePed(0, v.ped, v.loc.x, v.loc.y, v.loc.z, false, false)
Freeze(leanPeds[k], true, v.loc.w)
2026-01-18 01:20:44 -07:00
Bridge.Target.AddLocalEntity(leanPeds[k], {
2025-07-17 02:06:17 -05:00
{
icon = "fa-solid fa-hand-holding-medical",
2026-01-16 02:57:26 -07:00
label = Bridge.Language.Locale('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