Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local HUD = {}
- local lstMoney=getPlayerMoney()
- local tmpMoney=getPlayerMoney()
- local lstMoneyTs=getTickCount()
- local lstMoneyDiff=0
- local sx,sy=guiGetScreenSize()
- local px,py = (sx/1600),(sy/900)
- HUD.render = function()
- if (getElementData(localPlayer, "player:logged")) then
- if lstMoney~=getPlayerMoney() then
- lstMoneyDiff=getPlayerMoney()-lstMoney
- lstMoneyTs=getTickCount()
- lstMoney=getPlayerMoney()
- end
- if tmpMoney~=getPlayerMoney() then
- local roznica=math.abs(getPlayerMoney()-tmpMoney)
- if roznica<2 then
- tmpMoney=getPlayerMoney()
- elseif roznica<100 then
- if tmpMoney>getPlayerMoney() then
- tmpMoney=tmpMoney-1
- elseif tmpMoney<getPlayerMoney() then
- tmpMoney=tmpMoney+1
- end
- elseif roznica<1000 then
- if tmpMoney>getPlayerMoney() then
- tmpMoney=tmpMoney-100
- elseif tmpMoney<getPlayerMoney() then
- tmpMoney=tmpMoney+100
- end
- elseif roznica<10000 then
- if tmpMoney>getPlayerMoney() then
- tmpMoney=tmpMoney-1000
- elseif tmpMoney<getPlayerMoney() then
- tmpMoney=tmpMoney+1000
- end
- else
- if tmpMoney>getPlayerMoney() then
- tmpMoney=tmpMoney-10000
- elseif tmpMoney<getPlayerMoney() then
- tmpMoney=tmpMoney+10000
- end
- end
- end
- local pmoney=string.format("EUR %08.2f",tmpMoney)
- 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)
- 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)
- if lstMoneyDiff~=0 and getTickCount()-lstMoneyTs<5000 then
- local t=string.format("%s%.2f", lstMoneyDiff<0 and "" or "+ ", lstMoneyDiff)
- local a=1-(getTickCount()-lstMoneyTs)/5000
- 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)
- 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)
- end
- end
- end
- addEventHandler("onClientRender", root, HUD.render)
- HUD.start = function()
- setPlayerHudComponentVisible("money", false)
- end
- addEventHandler("onResourceStart", resourceRoot, HUD.start)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement