Guest Posted January 26, 2008 Share Posted January 26, 2008 Hello all, I recently edited a lua file in such a way which prevented vehicles to respawn, however as a result of this destroyed models still appear in position. What must I delete or add so that these destroyed models do not stay along for long if at all if possible once a vehicle has been destroyed? Link to comment
50p Posted January 26, 2008 Share Posted January 26, 2008 Use function: destroyElement() Pass there vehicle element, the vehicle that exploded. Link to comment
khepra Posted January 28, 2008 Share Posted January 28, 2008 I had the same problem, so I fixed it with this code: function vehicleExplode () --destroy wreck after 5 minutes setTimer( destroyElement, 300000, 1, source) end addEventHandler ( "onVehicleExplode", getRootElement(), vehicleExplode ) Of course, if you don't want the wreck at all, you can just call destroyElement(source) instead of the timer. Link to comment
Guest Posted January 29, 2008 Share Posted January 29, 2008 This is the one I use, it's only a slight variation of the one just posted and the one on the wiki. The differences are it respawns the car in its original position after the given time (6 seconds in this example) - or alternatively if it's a spawned vehicle that isn't part of the .map - it destroys it to stop the map getting cluttered up (also avoids 'andromeda hell' if you use a /createvehicle type command ) function vehicleExplode () -- if vehicle is part of the .map if (getElementID ( source ) ~= nil and getElementID ( source ) ~= "" ) then -- respawn it setTimer ( respawnVehicle, 6000, 1, source ) else -- otherwise -- destroy setTimer ( destroyElement, 6000, 1, source ) end end addEventHandler ( "onVehicleExplode", getRootElement(), vehicleExplode ) Link to comment
mdm13 Posted February 1, 2008 Share Posted February 1, 2008 I tried that last script and it seems to delete wrecks which is good, but doesnt respawn cars that are part of the map file. Anyone knows what's the deal? Link to comment
DoKtoR Posted March 24, 2008 Share Posted March 24, 2008 This works good if cars are in the .map file: function onVehicleExplode () setTimer(respawnVehicle, 5000, 1, source) end addEventHandler ( "onVehicleExplode", getRootElement(), onVehicleExplode ) 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