fix(esx_taxijob): make sure it works

This commit is contained in:
Mycroft
2022-09-18 00:54:22 +01:00
parent af61c1f9f7
commit a7abd8bc50
2 changed files with 15 additions and 36 deletions
+15 -35
View File
@@ -40,30 +40,18 @@ function ShowLoadingPromt(msg, time, type)
end
function GetRandomWalkingNPC()
local search = {}
local peds = ESX.Game.GetPeds()
for i = 1, #peds, 1 do
if IsPedHuman(peds[i]) and IsPedWalking(peds[i]) and not IsPedAPlayer(peds[i]) then
table.insert(search, peds[i])
local search = {}
local peds = GetGamePool("CPed")
for i = 1, #peds, 1 do
if IsPedHuman(peds[i]) and IsPedWalking(peds[i]) and not IsPedAPlayer(peds[i]) then
search[#search+1] = peds[i]
end
end
end
if #search > 0 then
return search[GetRandomIntInRange(1, #search)]
end
for i = 1, 250, 1 do
local ped = GetRandomPedAtCoord(0.0, 0.0, 0.0, math.huge + 0.0, math.huge + 0.0, math.huge + 0.0, 26)
if DoesEntityExist(ped) and IsPedHuman(ped) and IsPedWalking(ped) and not IsPedAPlayer(ped) then
table.insert(search, ped)
if #search > 0 then
return search[math.random(#search)]
end
end
if #search > 0 then
return search[GetRandomIntInRange(1, #search)]
end
end
function ClearCurrentMission()
@@ -197,11 +185,10 @@ function OpenVehicleSpawnerMenu()
ESX.ShowNotification(_U('spawnpoint_blocked'))
return
end
menu.close()
ESX.TriggerServerCallback("esx_taxijob:SpawnVehicle", function()
ESX.ShowNotification(_U('vehicle_spawned'), "success")
end, data.current.model, {plate = "TAXI JOB"})
end, "taxi", {plate = "TAXI JOB"})
menu.close()
end, function(data, menu)
CurrentAction = 'vehicle_spawner'
CurrentActionMsg = _U('spawner_prompt')
@@ -563,15 +550,9 @@ CreateThread(function()
local playerPed = PlayerPedId()
if CurrentCustomer == nil then
DrawSub(_U('drive_search_pass'), 5000)
if IsPedInAnyVehicle(playerPed, false) and GetEntitySpeed(playerPed) > 0 then
local waitUntil = GetGameTimer() + GetRandomIntInRange(30000, 45000)
while OnJob and waitUntil > GetGameTimer() do
Wait(0)
end
if OnJob and IsPedInAnyVehicle(playerPed, false) and GetEntitySpeed(playerPed) > 0 then
if IsPedInAnyVehicle(playerPed, false) and OnJob then
Wait(5000)
CurrentCustomer = GetRandomWalkingNPC()
if CurrentCustomer ~= nil then
@@ -591,7 +572,6 @@ CreateThread(function()
ESX.ShowNotification(_U('customer_found'))
end
end
end
else
if IsPedFatallyInjured(CurrentCustomer) then
-1
View File
@@ -55,7 +55,6 @@ ESX.RegisterServerCallback("esx_taxijob:SpawnVehicle", function(source, cb, mode
local SpawnPoint = vector3(Config.Zones.VehicleSpawnPoint.Pos.x, Config.Zones.VehicleSpawnPoint.Pos.y, Config.Zones.VehicleSpawnPoint.Pos.z)
ESX.OneSync.SpawnVehicle(joaat(model), SpawnPoint, Config.Zones.VehicleSpawnPoint.Heading, true, props, function(vehicle)
local vehicle = NetworkGetEntityFromNetworkId(vehicle)
print("Vehicle Spawned")
TaskWarpPedIntoVehicle(GetPlayerPed(source), vehicle, -1)
end)
cb()