sW,sH = guiGetScreenSize()
function convertNumber(number)
local formatted = number
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1 %2')
if (k==0) then
break
end
end
return formatted
end
addEventHandler("onClientRender", root, function()
local money = string.format("%.02f$", convertNumber(tonumber(getElementData(localPlayer, "player:money"))))
dxDrawText(money, sW*0.8045, sH*0.0840, sW*0.9832, sH*0.1589, tocolor(255,255, 255, 255), 1, "default-bold", "right", "center", false, false, false, true, false)
end)
He wants to display the money with a space, depending on how much he holds. Everything works fine, except for pennies, because they change every 20 minutes ie 30,50,80 and so in a wheel like I add 10 cents for example, I have to type it three times, otherwise it will not appear. I suppose this function is pissing me off because it's contained in string.gsub.