MIKI785 Posted March 28, 2011 Posted March 28, 2011 Hi, I have a small problem I have a deathmatch and I have some vehicles in it. But if I destroy it it wont respawn. How to make a respawn of these vehicles?
MIKI785 Posted March 30, 2011 Author Posted March 30, 2011 And this will perform on all vehicles? I need that.
proracer Posted March 30, 2011 Posted March 30, 2011 function respawnVehicles ( ) for i,v in ipairs ( getElementsByType ( 'vehicle' ) ) do setVehicleRespawnDelay ( v, 5000 ) end end addEventHandler ( 'onResourceStart', resourceRoot, respawnVehicles )
xXNemesiSXx Posted March 30, 2011 Posted March 30, 2011 im a noob on scripting but i think that resourceRoot in the event handler is wrong...
proracer Posted March 30, 2011 Posted March 30, 2011 It's not wrong... Note: every resource has a predefined global variable called resourceRoot whose value is the root element of that resource. https://wiki.multitheftauto.com/wiki/GetResourceRootElement
xXNemesiSXx Posted March 30, 2011 Posted March 30, 2011 so if it isnt wrong the script must work... the meta.xml ?
MIKI785 Posted March 30, 2011 Author Posted March 30, 2011 But it doesnt. I destroyed the car and nothing happened. It dont respawn.
Castillo Posted March 30, 2011 Posted March 30, 2011 Download this, and try it. http://www.mediafire.com/?yx4kv93n2kdcj82
Moderators Citizen Posted March 31, 2011 Moderators Posted March 31, 2011 Try this: function respawnTheVehicle( ) setTimer(respawnVehicle, 5000, 1, source ) end addEventHandler ( "onVehicleExplode", getRootElement(), respawnVehicles )
MIKI785 Posted March 31, 2011 Author Posted March 31, 2011 Download this, and try it.http://www.mediafire.com/?yx4kv93n2kdcj82 Doesnt work. OMG
Castillo Posted April 1, 2011 Posted April 1, 2011 Sounds like this function setVehicleRespawnDelay, doesn't work? or.. it's not used for this kind of script.
Moderators Citizen Posted April 1, 2011 Moderators Posted April 1, 2011 Sorry my bad retry with this: function respawnTheVehicle( ) setTimer(respawnVehicle, 5000, 1, source ) end addEventHandler ( "onVehicleExplode", getRootElement(), respawnTheVehicle)
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