#RooTs Posted March 19, 2016 Share Posted March 19, 2016 Hello, I've been noticing that. several scripts using as argument "source" are giving errors on the server and causing the fall. error on the console before the fall ... servivor bad argument in several scripts at the same time http://i.imgur.com/WSkhLZC.jpg givecar, erro in line 22 http://i.imgur.com/wLqrILo.png ejetar, erro in line 121 http://i.imgur.com/J1Ts1Bf.png givearmas, erro in line 26 http://i.imgur.com/XXFqK9A.png the doubt is. why these errors? and because they can cause the server crash ahhh friends I do not know what to do more Link to comment
Moderators IIYAMA Posted March 19, 2016 Moderators Share Posted March 19, 2016 1. Elements can turn invalid(destroyed) during the timer delay. So check with the function isElement if the elements are valid after the timer end. isElement 2. Source elements must pas through parameters in order to use them properly. In some parts of your script you did that, but in other parts not. And that crash might be caused by the terrible amount of timers you use. Vehicle respawning can be done with 1 timer, for ALL vehicles. Link to comment
GTX Posted March 20, 2016 Share Posted March 20, 2016 setTimer( function(p) setElementVelocity(p, ...) -- or whatever end, 5000, 1, source ) Link to comment
Moderators IIYAMA Posted March 20, 2016 Moderators Share Posted March 20, 2016 no, setTimer( function(p) if isElement(p) then setElementVelocity(p, ...) -- or whatever end end, 5000, 1, source ) Link to comment
GTX Posted March 20, 2016 Share Posted March 20, 2016 Collision/command handler will always return element, therefore isElement check isn't needed. Link to comment
Addlibs Posted March 20, 2016 Share Posted March 20, 2016 But that element might be destroyed by the time the timer is executed. It's always safer to check if it is in fact an element, not just a userdata. Link to comment
Moderators IIYAMA Posted March 21, 2016 Moderators Share Posted March 21, 2016 Collision/command handler will always return element, therefore isElement check isn't needed. As MrTasty says. If the referention of a userdata is always correct, even when using a timer, the warnings in the console wouldn't be valid. Yet they(warnings) are there, at places where hé did exacly the same as your example. #Roots wants to get rid of all those errors, this is how he can do that. 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