cokacola Posted February 22, 2009 Share Posted February 22, 2009 okay, hello, just wondering if it is possible to stop a car engine when you crash into something solid... they can start engine again, as i have a /engine script i found, but just wondered if you can stop car engine when crashing not really shore you can, but i'd like to try Link to comment
50p Posted February 22, 2009 Share Posted February 22, 2009 If setVehicleEngineState() works ok, then you can easily make such script. All you need to do is use that function in a onVehicleDamage event. Link to comment
cokacola Posted February 22, 2009 Author Share Posted February 22, 2009 okay thanks didn't notice there was a vehicle damage function but the car engine state works as i have /engine to start and stop the engine(found it here, but understand how it works ) thanks! Edit: Okay, I tried it, and it doesn't do anything...here is my code, and i smashed into many a wall with the car function stopEngine() setVehicleEngineState2(source, false) end addEventHandler("onVehicleDamage",getRootElement(),stopEngine) say...just does nothing EDIT: okay it works now, but its really easy to break a car.. just tap a pole and the engine stops, is it possible to make it so you'd have to hit something hard for it to stop? Link to comment
50p Posted February 22, 2009 Share Posted February 22, 2009 There is that parameter for triggered function in onVehicleDamage which is "loss". It represents how much damage your car got in this "hit", so just check if the "loss" is larger then some value and you're done. Read the wiki more, it's your best friend, just after google. Link to comment
cokacola Posted February 22, 2009 Author Share Posted February 22, 2009 is there somewhere in the wiki i can find onVehicleDamage - it doesn't appear to be there... Link to comment
Willy Posted February 22, 2009 Share Posted February 22, 2009 http://development.mtasa.com/index.php?title=OnVehicleDamage Link to comment
Thehookerkiller01 Posted March 4, 2009 Share Posted March 4, 2009 okay thanks didn't notice there was a vehicle damage function but the car engine state works as i have /engine to start and stop the engine(found it here, but understand how it works ) thanks! Edit: Okay, I tried it, and it doesn't do anything...here is my code, and i smashed into many a wall with the car function stopEngine() setVehicleEngineState2(source, false) end addEventHandler("onVehicleDamage",getRootElement(),stopEngine) say...just does nothing EDIT: okay it works now, but its really easy to break a car.. just tap a pole and the engine stops, is it possible to make it so you'd have to hit something hard for it to stop? Look this: function displayVehicleLoss(loss) local thePlayer = getVehicleOccupant(source) if(thePlayer) then -- Check there is a player in the vehicle outputChatBox("Your vehicle just lost " .. tonumber(loss) .. " health.", thePlayer) -- Display the message end end addEventHandler("onVehicleDamage", getRootElement(), displayVehicleLoss) And make a new onVehicleDamage with set how many HP it has to stop. Like 200. 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