1LoL1 Posted February 13, 2016 Share Posted February 13, 2016 (edited) Hello, i created script but idk how to respawnVehicle if is in water. Can anyone help me please? i tried this but not work addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function () car = createVehicle(id, x, y, z, rx, ry, rz) end) function RSP () if isElementInWater(car) then setTimer(respawnVehicle(car), 1000, 1) end end This work normally. addEventHandler("onVehicleExplode", getRootElement(), function () setTimer(respawnVehicle, 5000, 1, source) end) Edited February 13, 2016 by Guest Link to comment
tosfera Posted February 13, 2016 Share Posted February 13, 2016 change your timer to; setTimer ( RSP, 5000, 1, source ) after that you might have to change the RSP() to RSP ( car ) since the car will most likely not stay global ( once it exploded, the element will not be the same anymore ). Link to comment
1LoL1 Posted February 13, 2016 Author Share Posted February 13, 2016 change your timer to; setTimer ( RSP, 5000, 1, source ) after that you might have to change the RSP() to RSP ( car ) since the car will most likely not stay global ( once it exploded, the element will not be the same anymore ). Don't understand if i put this then where is respawnVehicle? Link to comment
Dimos7 Posted February 13, 2016 Share Posted February 13, 2016 addEventHandler("onVehicleExplode", root, function(theVehicle) if isElementInWater(theVehicle) then setTimer(respawnVehicle, 5000, 1, theVehicle) end setTimer(respawnVehicle, 5000, 1, source) end ) Link to comment
tosfera Posted February 13, 2016 Share Posted February 13, 2016 the "respawnVehicle" is inside the RSP function, all you need to do is pass the "source" ( the exploded vehicle ) as a parameter into that function and respawn it. The thing which Dominos7 said will not work since onVehicleExplode is not returning any parameters. Why do you want to check the waterstate though? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now