Is there a way to make a ped raise a bike upright and get on it if it is on its side on the ground? I’ve tried TaskEnterVehicle(ped, vehicle, 10.0, -1, 1.0, 1, 0) which doesn’t seem to work,
Could you show how you are getting both the ped, and the vehicle please?
I would have thought by standard the ped would want to pick the bike up by default, is this not the case?
Below is the code I use to create the vehicle and ped. I set vehicleHash to “enduro”:
RequestModel(vehicleHash)
while HasModelLoaded(vehicleHash) == false do
Citizen.Wait(0)
end
driver.vehicle = CreateVehicle(vehicleHash, driver.startWP.x, driver.startWP.y, driver.startWP.z, driver.heading, true, false)
SetModelAsNoLongerNeeded(vehicleHash)
SetVehicleEngineOn(driver.vehicle, true, true, false)
SetVehRadioStation(driver.vehicle, "OFF")
local pedHash = "a_m_y_skater_01"
RequestModel(pedHash)
while HasModelLoaded(pedHash) == false do
Citizen.Wait(0)
end
driver.ped = CreatePedInsideVehicle(driver.vehicle, PED_TYPE_CIVMALE, pedHash, -1, true, false)
SetModelAsNoLongerNeeded(pedHash)
SetDriverAbility(driver.ped, 1.0)
SetDriverAggressiveness(driver.ped, 0.0)
SetBlockingOfNonTemporaryEvents(driver.ped, true)
SetPedCanBeDraggedOut(driver.ped, false)
Then I set a destination:
TaskVehicleDriveToCoord(driver.ped, driver.vehicle, driver.destWP.x, driver.destWP.y, driver.destWP.z, 70.0, 1.0, GetEntityModel(driver.vehicle), 787004, driver.destWP.r * 0.5, true)
I knock the ped off the bike which is still driveable and the engine health is OK and try to get the ped to get back on which doesn’t seem to work:
Citizen.CreateThread(function()
local enteringVehicle = false
while true do
Citizen.Wait(0)
if IsPedInAnyVehicle(driver.ped, true) == false then
if false == enteringVehicle then
enteringVehicle = true
TaskEnterVehicle(driver.ped, driver.vehicle, 10.0, -1, 2.0, 1, 0)
end
else
enteringVehicle = false
end
end
end)
Nevermind, I actually got the ped to pick up the bike after some more code changes.
Awesome, would be great if you could share them here, and mark it as the solution. That way if anyone searches the same issue and needs a solution, you would be helping them alot ![]()
The changes involved a bit more than what I posted above which were specific to my code. The code I posted above to get the ped back on the bike actually worked fine.