Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. local HUD = {}
  2.  
  3. local lstMoney=getPlayerMoney()
  4. local tmpMoney=getPlayerMoney()
  5. local lstMoneyTs=getTickCount()
  6. local lstMoneyDiff=0
  7.  
  8. local sx,sy=guiGetScreenSize()
  9. local px,py = (sx/1600),(sy/900)
  10.  
  11. HUD.render = function()
  12. if (getElementData(localPlayer, "player:logged")) then
  13. if lstMoney~=getPlayerMoney() then
  14. lstMoneyDiff=getPlayerMoney()-lstMoney
  15. lstMoneyTs=getTickCount()
  16.  
  17. lstMoney=getPlayerMoney()
  18. end
  19.  
  20. if tmpMoney~=getPlayerMoney() then
  21. local roznica=math.abs(getPlayerMoney()-tmpMoney)
  22. if roznica<2 then
  23. tmpMoney=getPlayerMoney()
  24. elseif roznica<100 then
  25. if tmpMoney>getPlayerMoney() then
  26. tmpMoney=tmpMoney-1
  27. elseif tmpMoney<getPlayerMoney() then
  28. tmpMoney=tmpMoney+1
  29. end
  30. elseif roznica<1000 then
  31. if tmpMoney>getPlayerMoney() then
  32. tmpMoney=tmpMoney-100
  33. elseif tmpMoney<getPlayerMoney() then
  34. tmpMoney=tmpMoney+100
  35. end
  36. elseif roznica<10000 then
  37. if tmpMoney>getPlayerMoney() then
  38. tmpMoney=tmpMoney-1000
  39. elseif tmpMoney<getPlayerMoney() then
  40. tmpMoney=tmpMoney+1000
  41. end
  42. else
  43. if tmpMoney>getPlayerMoney() then
  44. tmpMoney=tmpMoney-10000
  45. elseif tmpMoney<getPlayerMoney() then
  46. tmpMoney=tmpMoney+10000
  47. end
  48. end
  49. end
  50. local pmoney=string.format("EUR %08.2f",tmpMoney)
  51. dxDrawText(pmoney, 1240*px + 1, 220*py + 1, 1516*px + 1, 252*py + 1, tocolor(0, 0, 0, 255), 2.00*px, "pricedown", "left", "center", true, true, false, true, false)
  52. dxDrawText(pmoney, 1240*px, 220*py, 1516*px, 252*py, tocolor(10,106,40), 2.00*px, "pricedown", "left", "center", true, true, false, true, false)
  53. if lstMoneyDiff~=0 and getTickCount()-lstMoneyTs<5000 then
  54. local t=string.format("%s%.2f", lstMoneyDiff<0 and "" or "+ ", lstMoneyDiff)
  55. local a=1-(getTickCount()-lstMoneyTs)/5000
  56. dxDrawText(t, 1240*px + 1, 247*py + 1, 1516*px + 1, 304*py + 1, tocolor(0, 0, 0, 255), 2.00*px, "pricedown", "right", "top", true, true, false, true, false)
  57. dxDrawText(t, 1240*px, 247*py, 1516*px, 304*py, lstMoneyDiff<0 and tocolor(90, 47, 38) or tocolor(10, 106, 40), 2.00*px, "pricedown", "right", "top", true, true, false, true, false)
  58. end
  59. end
  60. end
  61. addEventHandler("onClientRender", root, HUD.render)
  62.  
  63. HUD.start = function()
  64. setPlayerHudComponentVisible("money", false)
  65. end
  66. addEventHandler("onResourceStart", resourceRoot, HUD.start)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement