GEN-Gavin Posted February 26, 2011 Share Posted February 26, 2011 hi all am new at scripting lua but am lurning hard i have one quastion, how to respawn barrel and those missel and other object that can explode ore damage ore broken. i know litelbit of respawning car and pickups. but object that can be destroied i dont know i like to know how ore cant object respawn function respawnVehicle( vehicle ) spawnVehicle ( vehicle, getElementData( vehicle, "posX" ), getElementData( vehicle, "posY" ), getElementData( vehicle, "posZ" ), getElementData( vehicle, "rotX" ), getElementData( vehicle, "rotY" ), getElementData( vehicle, "rotZ" ) ) end function onVehicleSpawn () local x,y,z = getElementPosition (source) setElementData (source,"posX",x) setElementData (source,"posY",y) setElementData (source,"posZ",z) end addEventHandler ("onVehicleExplode",getRootElement(),onVehicleSpawn) function onVehicleExplode () setTimer( respawnVehicle, 5000, 1, source ) end addEventHandler("onVehicleExplode", getRootElement(), onVehicleExplode) this is a car respowner can i change some and make it to object respawner? Link to comment
Moderators Citizen Posted February 26, 2011 Moderators Share Posted February 26, 2011 Hi GEN-Gavin, I see the events in server side, and I found onElementDestroy BUT ! this event is only triggered when an object was detroyed by destroyElement( the Element ) so he doesn't work. Then I go to the Client Events and I found this: OnClientExplosion So you can use it but he's triggered only when an object explode ( like barrels ) Try this and tell me if it works Link to comment
GEN-Gavin Posted February 27, 2011 Author Share Posted February 27, 2011 i wil try this tomorrow i got some works at the admin base to make Link to comment
Moderators Citizen Posted February 27, 2011 Moderators Share Posted February 27, 2011 Ok no problem 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