Jump to content

destroyElement thing


roaddog

Recommended Posts

Well heyo guys.

I got a lil problem with this script, what am going to do is when the vehicle enters a the colshape, it will be destroyed and if the vehicle has a driver it won't be destroyed, but it doesnt work. Ima asking what should i do for this

   local myshape = createColCircle(1049.6279296875, -1029.674804687, 4) 
    function ColHit(hitElement) 
        thePlayer = getVehicleController ( hitElement) 
        if (getElementType(hitElement) =="vehicle" ) and not (thePlayer) then 
            destroyElement(hitElement) 
        end 
    end 
    addEventHandler( "onColShapeHit", myshape, ColHit ) 

Thank you, and i hope it gonna be fixed as soon as possible though

Link to comment
local myshape = createColCircle(1049.6279296875, -1029.674804687, 4) 
  
function ColHit(hitElement) 
    if getElementType(hitElement) == "vehicle" then 
        if not getVehicleController(hitElement) then 
            destroyElement(hitElement) 
        end 
    end 
end 
addEventHandler("onColShapeHit", myshape, ColHit) 

Link to comment

If I read it right on the wiki, getVehicleController will check forwards in the 'towing chain' if the vehicle you're checking does not have a driver. So it should still return true because you're driving the towtuck which is forwards in the chain. (If that makes sense.)

So you could use this

  
local myshape = createColCircle(1049.6279296875, -1029.674804687, 4) 
  
function ColHit(hitElement) 
    if getElementType(hitElement) == "vehicle" then 
        if not getVehicleOccupant(hitElement) then 
            destroyElement(hitElement) 
        end 
    end 
end 
addEventHandler("onColShapeHit", myshape, ColHit) 
  

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