Hey, I have tried to use both TaskWarpPedIntoVehicle and SetPedIntoVehicle to put a dead player into a vehicle and i’m having issues getting the player into the vehicle.
All help is appreciated!
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
if IsPedDeadOrDying(playerPed, true) then
if IsAnyVehicleNearPoint(coords, 5.0) then
local vehicle = VehicleInFront() --GetClosestVehicle(coords, 5.0, 0, 71)
if DoesEntityExist(vehicle) and IsEntityDead(playerPed) then
local maxSeats, freeSeat = GetVehicleMaxNumberOfPassengers(vehicle)
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
end
end
end
When the player gets put in the vehicle, they get un-dragged but their bodies never go into the vehicle
if freeSeat then is checking to see if it has a value not if it’s true or false. This part of it works completely fine, the part that’s giving issues seems to be
I’ll change it to that but it works with isPedDeadorDying native, just the task warp method isn’t working when they are dead. I have found a workaround temporarily but i’m still going to try what @anders said above. Thanks for the suggestions guys
if DoesEntityExist(closestVehicle) and closestVehicleSeat ~= nil then
DetachEntity(ped, true, true)
if IsEntityDead(ped) or IsPedRagdoll(ped) then
TaskWarpPedIntoVehicle(ped, closestVehicle, closestVehicleSeat)
else
...
...
It still feels like whatever you have detaching the entity is happening from this
dragStatus.isDragged = false
which is a line after you’re trying to warp them into the vehicle. I don’t think the ped will warp anywhere if it’s still attached to another entity, but I could be wrong
How did you end up getting it to work if you don’t mind. I’ve been trying to get something like this so our EMS can transport back to pillbox @blueeyedjoe
Well SetPedIntoVehicle() is working fine with dead ped but the problem I found it mostly only dead player see themselves warp into the vehicle… but other players around that area mostly see them just lying near the vehicle and doesn’t go in the car… but sometimes it just works fine everyone sees the same things they all went in the car but not that long after that it gonna buggy again… I hope there is a way to do this thing and it works just fine cause it gonna make RP more fun and realistic.
And I saw one on the forum say about making players that suppose to be dead not that really dead in-game way but just put them in some state that makes it feel like they are dead cause some native gonna functional with alive ped more than dead ped and maybe we can just put them in vehicles bra bra bra and no more for falling through the ground after dead? or some dead ped appears in different pos for one player and another player… but it kinda needs to rewrite a lot of scripts that involve a dead player it kinda good idea? but for someone lazy like me I’m just hoping for some easy solutions for this buggy dead ped put in vehicle
sorry for my English btw.^^