Jump to content

Lags :O


roaddog

Recommended Posts

Heya,

so why if i run this script, server will be frozen and shutting down automaticly ? :o

  
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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...