Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mojeW,mojeH = 1920, 1080
- sW,sH = guiGetScreenSize()
- w, h = (sW/mojeW), (sH/mojeH)
- skalaX = (sW/mojeW)
- skalaY = (sH/mojeH)
- FontSize = (skalaX)
- local weaponId = getPedWeapon(localPlayer)
- local weaponName = getWeaponNameFromID(weaponId)
- local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" }
- local bar = {
- y_hp = 40,
- y_armor = 70,
- y_tlen = 100
- }
- local bg = {
- y_hp = 35,
- y_armor = 65,
- y_tlen = 95,
- bg_dlug = 100
- }
- function draw()
- outputChatBox(""..weaponName.."")
- local players = getElementsByType ( "player" )
- local money = getPlayerMoney(localPlayer)
- local time = getRealTime()
- local hours = time.hour
- local minutes = time.minute
- local seconds = time.second
- -- bg
- dxDrawRectangle(1662*w, 0*h, 241*w, bg.bg_dlug*h, tocolor(1, 0, 0, 198), false)
- dxDrawRectangle(1662*w, -5*h, 241*w, 12*h, tocolor(38, 118, 16, 170), false)
- -- liczenie czasu
- if (hours < 10) then
- hours = "0"..hours
- end
- if (minutes < 10) then
- minutes = "0"..minutes
- end
- -- tlen
- for k,v in ipairs ( players ) do
- if isPedInWater ( v ) then
- bg.bg_dlug = 126
- dxDrawRectangle(1641+50*w, bg.y_tlen*h, 182*w, 23*h, tocolor(1, 1, 0, 255), false)
- dxDrawProgressBar( 1646+50*w, bar.y_tlen*h, 172*w, 13*h, math.floor(getPedOxygenLevel(localPlayer)), tocolor( 16, 128, 188, 255), tocolor( 12, 85, 124, 200) )
- else
- bg.bg_dlug = 105
- end
- end
- -- hp
- dxDrawRectangle(1641+50*w, bg.y_hp*h, 182*w, 23*h, tocolor(1, 1, 0, 255), false)
- dxDrawProgressBar( 1646+50*w, bar.y_hp*h, 172*w, 13*h, math.floor(getElementHealth(localPlayer)), tocolor( 165, 16, 16, 255), tocolor( 119, 12, 12, 200) )
- -- armor
- dxDrawRectangle(1641+50*w, bg.y_armor*h, 182*w, 23*h, tocolor(1, 1, 0, 255), false)
- dxDrawProgressBar( 1646+50*w, bar.y_armor*h, 172*w, 13*h, math.floor(getPlayerArmor(localPlayer)), tocolor( 150, 150, 150, 255), tocolor( 40, 40, 40, 200) )
- -- hajs i godzina
- dxDrawText(""..money.."$", 1696*w, 19*h, 1762*w, 35*h, tocolor(12, 181, 12, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
- dxDrawText(""..hours..":"..minutes.."", 1839*w, 19*h, 1905*w, 35*h, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
- end
- addEventHandler("onClientRender", root, draw)
- -- bindKey("F7", "up", function(he, md)
- -- local data = getElementData(localPlayer, "gracz:hud") or false
- -- if data then
- -- removeEventHandler("onClientRender",root,draw)
- -- setElementData(localPlayer, "gracz:hud", false)
- -- else
- -- setElementData(localPlayer, "gracz:hud", true)
- -- addEventHandler("onClientRender", root, draw)
- -- end
- -- end)
- local unlerp = function(from,to,lerp) return (lerp-from)/(to-from) end
- function dxDrawProgressBar( startX, startY, width, height, progress, color, backColor )
- local progress = math.max( 0, (math.min( 100, progress) ) )
- local wBar = width*.2
- for i = 0, 4 do
- --back
- local startPos = (wBar*i + (width*.0001)*i) + startX
- dxDrawRectangle( startPos, startY, wBar, height, backColor )
- --progress
- local eInterval = (i*20)
- local localProgress = math.min( 1, unlerp( eInterval, eInterval + 20, progress ) )
- if localProgress > 0 then
- dxDrawRectangle( startPos, startY, wBar*localProgress, height, color )
- end
- end
- end
- addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
- function ()
- for _, component in ipairs( components ) do
- setPlayerHudComponentVisible( component, false )
- end
- end)
- local anims, builtins = {}, {"Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce", "SineCurve", "CosineCurve"}
- function table.find(t, v)
- for k, a in ipairs(t) do
- if a == v then
- return k
- end
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement