CaptainZ. Posted July 1, 2013 Share Posted July 1, 2013 How can I get if vehicle is destroyed? Link to comment
Dealman Posted July 1, 2013 Share Posted July 1, 2013 Before making questions like this, try to look at the MTA Wiki. Think of things like this; You need a way to see when a vehicle is destroyed, so what you need is an event. Head over to the MTA Wiki, look at Client Events - and then what you need. Right now, you need to look at Vehicle Events. In there you'll find onClientVehicleExplode which might be what you need. (onVehicleExplode for server-side) The Wiki is your best friend Link to comment
Castillo Posted July 1, 2013 Share Posted July 1, 2013 There's also the "onElementDestroy" event for when an element is destroyed by destroyElement. https://wiki.multitheftauto.com/wiki/OnElementDestroy Link to comment
Spajk Posted July 1, 2013 Share Posted July 1, 2013 I think he's asking for a function like "isVehicleDestroyed(vehicle)" to check if vehicle has blown. I am not sure whats the best way to do it, but, this is how I would do it: First I would create an empty table called isVehicleDestroyed = {} Then I would add an event handler for "onVehicleExplode" and inside it, I would do "isVehicleDestroyed[source] = true" After that, I would add an event handler for " onElementDestroy" and do "isVehicleDestroyed[source] = nil" Then somewhere inside code I could use isVehicleDestroyed[vehicle] to check if its blown or not. Ofcourse, this way is really bad, because it doesnt detect if fixVehicle() was used and I am sure that there's a muvh simpler way using getElementHealth(), but I dont have time to experiment with it. Sorry for typing mistakes, I used my phone to type this. Link to comment
CaptainZ. Posted July 2, 2013 Author Share Posted July 2, 2013 Thank you Dealman, I used onVehicleExplode. I did it like this function destroyBlip() destroyElement(blip) end addEventHandler("onVehicleExplode", vehicleC, onvehblow) Link to comment
iMr.3a[Z]eF Posted July 2, 2013 Share Posted July 2, 2013 Thank you Dealman, I used onVehicleExplode.I did it like this function destroyBlip() destroyElement(blip) end addEventHandler("onVehicleExplode", vehicleC, onvehblow) function destroyBlip() if ( isVehicleBlown ( vehicleC ) ) then destroyElement(blip) end end addEventHandler("onVehicleExplode", vehicleC, onvehblow) Link to comment
CaptainZ. Posted July 3, 2013 Author Share Posted July 3, 2013 The current one works for me Link to comment
PaiN^ Posted July 3, 2013 Share Posted July 3, 2013 @ 6ArHxiMr'3a[Z]eF : Your check is useless, since the "onVehicleExplode" event well be triggered when a vehicle blow . Link to comment
iMr.3a[Z]eF Posted July 3, 2013 Share Posted July 3, 2013 @ 6ArHxiMr'3a[Z]eF : Your check is useless, since the "onVehicleExplode" event well be triggered when a vehicle blow . I really dont understand ya Link to comment
AMARANT Posted July 3, 2013 Share Posted July 3, 2013 @ 6ArHxiMr'3a[Z]eF : Your check is useless, since the "onVehicleExplode" event well be triggered when a vehicle blow . I really dont understand ya He means that "onVehicleExplode" event already checks a blown vehicle, so "isVehicleBlown" function is unnecessary. 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