Hey,
i am having an issue regarding a certain script. I am trying to create a script, in which the player will automaticly exit the vehicle once it catches fire / has a certain amount of health left.
this is what I currently have :
[lua]
setTimer(
function (player)
local yass = getPedOccupiedVehicle(player)
for _, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do
if getElementHealth(vehicle) < 301 then
setVehicleDamageProof( vehicle, true)
setVehicleEngineState( vehicle, false)
setTimer(removeThePed, 100, 1)
else
if getElementHealth(vehicle) > 302 then
setVehicleDamageProof( vehicle, false)
setVehicleEngineState( vehicle, true)
end
end
end
end,
100, 0
)
function removeThePed ( )
removePedFromVehicle ( yass ) -- Removes the ped from any vehicle.
end
[/lua]
From what I know I tried my best to get things working correctly. The damage proof and engine state works fine, but the player wont exit the vehicle.
if anyone could assist me, that would be great,
joriss11