TimeTraveller Posted August 20, 2022 Share Posted August 20, 2022 I have the script of Money scoreboard in my server, if you have for example, a million of dollars it appears like "1000000" but i don't know how to modify for it appears like "1.000.000" with points or "100.000" "1.000". I am new in this page and hello to everyone. Im not new in MTA and i saw a lot of functions here but i don't know how to do that. 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
Tails Posted August 21, 2022 Share Posted August 21, 2022 From http://lua-users.org/wiki/FormattingNumbers, slightly simplified: function comma_value(n) return tostring(n):reverse():gsub('(%d%d%d)','%1,'):reverse() end print(comma_value(4024910100)) --> 4,024,910,100 Hope this helps 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