Tails Posted November 15, 2012 Share Posted November 15, 2012 Hi there, function explodeVehiclesInWater ( ) local vehicles = getElementsByType ( "vehicle" ) for _, vehicle in ipairs ( vehicles ) do if isElementInWater( vehicle ) then setTimer ( function() blowVehicle( vehicle, true ) end, 10000, 1 ) end end end addEventHandler ( "onResourceStart", root, explodeVehiclesInWater ) If you read the script then you know I want. I need this script to explode vehicles when they go under water. Ofcourse it's not working so if anyone could take a look and tell me what's wrong with it I would appreciate it a lot! Thanks in advance Link to comment
Castillo Posted November 15, 2012 Share Posted November 15, 2012 You want to check every 10 seconds for vehicles in wanter and blow them up? Link to comment
Tails Posted November 15, 2012 Author Share Posted November 15, 2012 No, this is a script for freeroam, so if you someone drives their vehicle into the water I need it to explode so my respawn script can respawn it. Link to comment
Castillo Posted November 15, 2012 Share Posted November 15, 2012 Yes, but your script is currently setting a timer for every vehicle that is in water to blow it up, only when the resource start. Link to comment
Tails Posted November 15, 2012 Author Share Posted November 15, 2012 Okay but how do I fix that? Link to comment
Castillo Posted November 15, 2012 Share Posted November 15, 2012 setTimer ( function ( ) for _, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do if isElementInWater ( vehicle ) then blowVehicle ( vehicle, true ) end end end , 10000, 0 ) Link to comment
Tails Posted November 15, 2012 Author Share Posted November 15, 2012 Thank you , I appreciate it! Although, I found it won't explode sometimes when the player isn't in the vehicle. 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