Jump to content

developa

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by developa

  1. developa

    Cents

    Hello, I have something wrong with pennies. At about three million groschen bugs and jumps at twenty, instead of as much as I want, it means showing in turn: 30, 50, 80. Help! Code: function takeMoney(player, price) if player and price then local cash = tonumber(getElementData(player, "player:money")) if cash >= tonumber(price) then setElementData(player, "player:money", tonumber(getElementData(player, "player:money") or 0)-price) return true else return false end end end function giveCash(player, price) if player and price then setElementData(player, "player:money", tonumber(getElementData(player, "player:money") or 0)+price) end end addEvent("giveCash", true) addEventHandler("giveCash", root, function(value) if value then giveCash(source, value) end end) addEvent("takeCash", true) addEventHandler("takeCash", root, function(price) if price then takeMoney(source, price) end end)
  2. developa

    Money

    Displayed: 3815818.3 If I add the function string.format there will appear 3815818.30. Everything works, and if you add this feature it will cracks up. If I add 5 cents to my cash it will be 3815818.35, and in the hud with this function will appear 3815818.30 ;/
  3. developa

    Money

    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.
  4. developa

    Money

    Unfortunately, this example does not work. Without this feature everything works, and as you add it will give you something else because every 20 cents.
  5. developa

    Money

    Thanks, it works but I have a problem. I have a heel system for the element-date with pennies, and they are badly changed. Now I have this code: convertNumber(string.format("%.02f$", getElementData(localPlayer, "player:money"))) and pennies change every 20 cents, whatever I type for example 10 cents and not add it, only change every 30, 50, 80 cents. I tried this: string.format("%.02f$", convertNumber(getElementData(localPlayer, "player:money"))) but it does not work (there is an error in debugscript3 - bad argument # 2 is 'format' (number expected, got string)). Help.
  6. developa

    Money

    Hello how to separate player cash? Does that mean that if a player holds a thousand dollars for example, instead of 1000, he writes 1 000 if he has 10000 and he writes 10 000 and so on?
  7. Hi, how to detect if a player is in a marker with correct rotation? So, for example, it must be front and not back.
×
×
  • Create New...