Jump to content

Can someone help me?


Stylez

Recommended Posts

Hey everybody. i am newbie in MTA scripting, but i badly wanna learn it and after few weeks of reading wiki. i tried to make my own script.

which will delete the blown cars.

i managed to make it so far :arrowdown: (serverSide)

function refresh (theVehicle) 
local vehicles = getElementsByType("Vehicle") 
    if isVehicleBlown(theVehicle) then 
        destroyElement(vehicles) 
    end 
end 
addEventHandler("onVehicleExplode", getRootElement(), refresh) 
setTimer(refresh, 5000, 0) 

but when i run it. it shows errors in debug "Bad argument @ isVehicleBlown" :/

sry, for my english :]

Link to comment

Yes, because you not use argument in timer.

Also bad idea add event handler in timer :/

And i not understand why you need timer.

Maybe you need if vehicle explode it destroyed in next seconds?

  
function fExplode ( ) 
        setTimer( destroyElement, 5000, 1, source ) 
end 
addEventHandler( 'onVehicleExplode', root, fExplode ) 
  

You mean it?

Edited by Guest
Link to comment
Yes, because you not use argument in timer.

Also bad idea add event handler in timer :/

And i not understand why you need timer.

Maybe you need if vehicle explode it destroyed in next seconds?

  
function fExplode ( ) 
        setTimer( destroyElement, 5000, 1, source ) 
end 
addEventHandler( 'onVehicleExplode', root, fExplode ) 
  

You mean it?

yes thats what i meant. thankyou. :]

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