isa_Khamdan Posted October 22, 2013 Share Posted October 22, 2013 Hello , I have created a vehicle on my code outside function and i added local so it will only exists on this resource and my question is how can i re-create the vehicle after it get destroyed? Else i want it to replace the old variable but it will have the same name. local Car = createVehicle(model ,x,y,z) function() ..... end Link to comment
isa_Khamdan Posted October 22, 2013 Author Share Posted October 22, 2013 It doesn't respawn the vehicle if it get destroyed from admin panel local Car = createVehicle ( 547, 3108, -3178, 0 ) function Check() if not (isElement(Car)) then respawnVehicle ( Car ) end end setTimer ( Check, 1000, 0) Link to comment
csiguusz Posted October 22, 2013 Share Posted October 22, 2013 It respawn only elements that has been blown up. If you destroy them with destroyElement then you have to re-create it with createVehicle. Link to comment
isa_Khamdan Posted October 22, 2013 Author Share Posted October 22, 2013 It respawn only elements that has been blown up. If you destroy them with destroyElement then you have to re-create it with createVehicle. hmm I know how to do it but how can I make it exists on the whole resource not in the function only if I put local it will only exists on that function : Link to comment
csiguusz Posted October 22, 2013 Share Posted October 22, 2013 Then just don't use local to make the variable global. Link to comment
isa_Khamdan Posted October 22, 2013 Author Share Posted October 22, 2013 Thanks for your help. 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