roaddog Posted August 10, 2014 Share Posted August 10, 2014 Heya, so why if i run this script, server will be frozen and shutting down automaticly ? exports [ "scoreboard" ]:addScoreboardColumn ( "Gang",getRootElement() ,40,80, "Gang" ) function getgang() local group = exports.groupsystem:getPlayerGroup(source) if group then ---outputChatBox(group) setElementData(source, "Gang", group) end setTimer ( getgang, 2500, 0 ) end addCommandHandler("gang", getgang) addEventHandler( "onPlayerLogin", getRootElement(), getgang ) Link to comment
xXMADEXx Posted August 10, 2014 Share Posted August 10, 2014 There's nothing that I see in the script that would cause the server to lag (unless it's the getPlayerGroup function), but the timer on line 9 is totally pointless, you should remove it. Link to comment
Et-win Posted August 10, 2014 Share Posted August 10, 2014 Why is the setTimer pointless? The element data doesn't refresh on his own mhm... Link to comment
Mr_Moose Posted August 10, 2014 Share Posted August 10, 2014 You're getting a stack overflow there. The timer will do it's work forever due to argument three which you set to '0' and each time the function is called you're starting a new timer that continues forever, the result is an infinite amount of timers that spam this function. Most compilers or frameworks has protection against this, i.e know already from the start that everything will fail, the shutdown is a security process to prevent more serious issues like a full system crash like BSOD on Windows. Link to comment
xXMADEXx Posted August 10, 2014 Share Posted August 10, 2014 Why is the setTimer pointless? The element data doesn't refresh on his own mhm... There wouldn't be a source. Not only that but everytime the function is called it makes a new timer therefore there could be like 1000 timers -> Lag Link to comment
Et-win Posted August 10, 2014 Share Posted August 10, 2014 Oops, didn't see that both things Link to comment
roaddog Posted August 10, 2014 Author Share Posted August 10, 2014 OMG, Thank you guys your info has saved my life. I didn't know 'bout stack overflow, useful info. 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