Jump to content

Question


Recommended Posts

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

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
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
@ 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...