Chaos Posted September 6, 2013 Share Posted September 6, 2013 hi, how to use that function convertNumber with money scoreboard ?? exports [ "scoreboard" ]:addScoreboardColumn ( "Money", 3 ) -- Add the "Money" column to the scoreboard. function updatePlayersMoney ( ) -- Create "updatePlayersMoney" function. for index, player in ipairs ( getElementsByType "player" ) do -- Loop through all online players. setElementData ( player, "Money", getPlayerMoney ( player ) ) -- Set "Money" element data to the player money. end -- End our loop. end -- End our function. setTimer ( updatePlayersMoney, 2500, 0 ) -- Set a infinite 2.5 seconds timer to execute "updatePlayersMoney" function. Link to comment
Chaos Posted September 6, 2013 Author Share Posted September 6, 2013 where should i add it ? Link to comment
MIKI785 Posted September 6, 2013 Share Posted September 6, 2013 You want to use it for the Money column in scoreboard, right? Use this then: exports [ "scoreboard" ]:addScoreboardColumn ( "Money", 3 ) -- Add the "Money" column to the scoreboard. function updatePlayersMoney ( ) -- Create "updatePlayersMoney" function. for index, player in ipairs ( getElementsByType "player" ) do -- Loop through all online players. setElementData ( player, "Money", convertNumber(getPlayerMoney ( player )) ) -- Set "Money" element data to the player money. end -- End our loop. end -- End our function. setTimer ( updatePlayersMoney, 2500, 0 ) -- Set a infinite 2.5 seconds timer to execute "updatePlayersMoney" function. Was that so hard? Link to comment
Chaos Posted September 7, 2013 Author Share Posted September 7, 2013 oh thanks but how to add $ with number ? Link to comment
TAPL Posted September 7, 2013 Share Posted September 7, 2013 oh thanks but how to add $ with number ? setElementData ( player, "Money", "$"..convertNumber(getPlayerMoney ( player )) ) Link to comment
Chaos Posted September 7, 2013 Author Share Posted September 7, 2013 thanks TAPL and MIKI785 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