bosslorenz Posted January 4, 2015 Share Posted January 4, 2015 exports.scoreboard:addScoreboardColumn('Money')function setstats () local account = getPlayerAccount (source) local money = getPlayerMoney ( source ) setElementData ( source, "Money", "$" .. money ) end addEventHandler ( "onPlayerSpawn", getRootElement(), setstats ) addEventHandler ( "onPlayerLogin", getRootElement(), setstats ) Its working fine but it just not update . It only updates when reconnecting. I want to make it update every 10 secs. Link to comment
darhal Posted January 4, 2015 Share Posted January 4, 2015 exports.scoreboard:addScoreboardColumn('Money') function setstats () local account = getPlayerAccount (source) local money = getPlayerMoney ( source ) setElementData ( source, "Money", "$" .. money ) end addEventHandler ( "onPlayerSpawn", getRootElement(), setstats ) addEventHandler ( "onPlayerLogin", getRootElement(), setstats ) function updateStats() for i, v in ipairs(getElementsByType("player")) do local money = getPlayerMoney ( v ) setElementData ( v, "Money", "$" .. money ) end end setTimer(updateStats, 10000, 0) 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