Jump to content

Problem with onVehicleExplode


Recommended Posts

Posted

Right here's the bit of code

  
function destroyVehicle () 
    interior = getElementInterior ( source ) 
    --outputConsole("interior: "..interior) 
    if interior == 15 then 
        destroyElement(source) 
    end 
end 
addEventHandler("onVehicleExplode", getRootElement(), destroyVehicle) 
  
  

Before I commented out the outputConsole bit I kept getting errors "Attempt to concentrate interior (A boolean Value)"

What I don't understand is why the line

interior = getElementInterior ( source ) 

is returning a false value as the vehicle is the source of the event "onVehicleExplode"

Cheers for your help and time

Posted

Then start debugging. outputChatBox/outputDebugString what source is (use tostring( source ) or type( source ) ), if it's "userdata" it means it's an element, then try getElementType( source ).

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