fix(ambulance+police): Put more than 1 person into a vehicle

This commit is contained in:
Linden
2021-06-30 01:57:37 +10:00
parent d64f782d72
commit c5611f47b4
2 changed files with 21 additions and 29 deletions
+10 -14
View File
@@ -389,24 +389,20 @@ end)
RegisterNetEvent('esx_ambulancejob:putInVehicle')
AddEventHandler('esx_ambulancejob:putInVehicle', function()
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local vehicle, distance = ESX.Game.GetClosestVehicle()
if IsAnyVehicleNearPoint(coords, 5.0) then
local vehicle = GetClosestVehicle(coords, 5.0, 0, 71)
if vehicle and distance < 5 then
local maxSeats, freeSeat = GetVehicleMaxNumberOfPassengers(vehicle)
if DoesEntityExist(vehicle) then
local maxSeats, freeSeat = GetVehicleMaxNumberOfPassengers(vehicle)
for i=maxSeats - 1, 0, -1 do
if IsVehicleSeatFree(vehicle, i) then
freeSeat = i
break
end
for i=maxSeats - 1, 0, -1 do
if IsVehicleSeatFree(vehicle, i) then
freeSeat = i
break
end
end
if freeSeat then
TaskWarpPedIntoVehicle(playerPed, vehicle, freeSeat)
end
if freeSeat then
TaskWarpPedIntoVehicle(playerPed, vehicle, freeSeat)
end
end
end)
+11 -15
View File
@@ -1114,25 +1114,21 @@ RegisterNetEvent('esx_policejob:putInVehicle')
AddEventHandler('esx_policejob:putInVehicle', function()
if isHandcuffed then
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local vehicle, distance = ESX.Game.GetClosestVehicle()
if IsAnyVehicleNearPoint(coords, 5.0) then
local vehicle = GetClosestVehicle(coords, 5.0, 0, 71)
if vehicle and distance < 5 then
local maxSeats, freeSeat = GetVehicleMaxNumberOfPassengers(vehicle)
if DoesEntityExist(vehicle) then
local maxSeats, freeSeat = GetVehicleMaxNumberOfPassengers(vehicle)
for i=maxSeats - 1, 0, -1 do
if IsVehicleSeatFree(vehicle, i) then
freeSeat = i
break
end
for i=maxSeats - 1, 0, -1 do
if IsVehicleSeatFree(vehicle, i) then
freeSeat = i
break
end
end
if freeSeat then
TaskWarpPedIntoVehicle(playerPed, vehicle, freeSeat)
dragStatus.isDragged = false
end
if freeSeat then
TaskWarpPedIntoVehicle(playerPed, vehicle, freeSeat)
dragStatus.isDragged = false
end
end
end