MatXpl Posted December 31, 2010 Share Posted December 31, 2010 Hi! I make this code: function nobum() local vehicle = getElementsByType ( "vehicle" ) if ( isVehicleFuelTankExplodable ( vehicle ) ) then setVehicleDamageProof ( vehicle, true ) end end addEventHandler("onVehicleDamage", getRootElement(), nobum) function damage() local vehicle = getElementsByType ( "vehicle" ) if isVehicleDamageProof ( vehicle ) then timerv = setTimer (function() setVehicleEngineState ( vehicle, false ) end, 2100, 1) resetTimer ( timerv ) end end addEventHandler("onVehicleDamage", getRootElement(), damage) and i wont to car no explode but this script dosn't work debugscript: Bad argument @ 'isVehicleFuelTankExplodable Bad argument @ 'isVehicleDamageProof pls Help what is wrong ? Link to comment
MexUK Posted December 31, 2010 Share Posted December 31, 2010 try this: function nobum() if ( isVehicleFuelTankExplodable ( source ) ) then setVehicleDamageProof ( source, true ) end end addEventHandler("onVehicleDamage", getRootElement(), nobum) function damage() if isVehicleDamageProof ( source ) then setTimer (setVehicleEngineState, 2100, 1, source, false) end end addEventHandler("onVehicleDamage", getRootElement(), damage) https://wiki.multitheftauto.com/wiki/OnVehicleDamage Link to comment
Aibo Posted December 31, 2010 Share Posted December 31, 2010 pls Help what is wrong ? getElementsByType() returns a table of elements. not a single element. Link to comment
Scooby Posted December 31, 2010 Share Posted December 31, 2010 you could always edit the code that spawns the cars in the first place, am i right in thinking you just want the cars to not explode when the gas tank is hit? if so, you could use: bool setVehicleFuelTankExplodable ( vehicle theVehicle, bool explodable ) wherever the cars are created, just add this as the next line: setVehicleFuelTankExplodable (theVehicle, false) if im wrong and you just dont want cars to explode ever.. you could use cancelEvent() in onVehicleExplode Link to comment
Aibo Posted December 31, 2010 Share Posted December 31, 2010 you could use cancelEvent() in onVehicleExplode cancelling this event wont stop the explosion, tested that not long ago in some topic here Link to comment
MatXpl Posted December 31, 2010 Author Share Posted December 31, 2010 try this: function nobum() if ( isVehicleFuelTankExplodable ( source ) ) then setVehicleDamageProof ( source, true ) end end addEventHandler("onVehicleDamage", getRootElement(), nobum) function damage() if isVehicleDamageProof ( source ) then setTimer (setVehicleEngineState, 2100, 1, source, false) end end addEventHandler("onVehicleDamage", getRootElement(), damage) https://wiki.multitheftauto.com/wiki/OnVehicleDamage Thanks, but car explode... @Edit I edit this code and its works ( I used https://wiki.multitheftauto.com/wiki/GetElementHealth ) Thanks 4 all! 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