smigi
Wiek: 23 Na forum: 3367 dni Posty: 60
Nick w MP: smigi
Piwa : 2
Kod: local sw, sh=guiGetScreenSize()
local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted", "vehicle_name", "area_name", "radio" }
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
function ()
for _, component in ipairs( components ) do
setPlayerHudComponentVisible( component, false )
end
end)
local fps = false
function getCurrentFPS()
return fps
end
local function updateFPS(msSinceLastFrame)
fps = (1 / msSinceLastFrame) * 1000
end
addEventHandler("onClientPreRender", root, updateFPS)
local function drawFPS()
if not getCurrentFPS() then
return
end
if getElementData(localPlayer,"licznik:fps") then
local roundedFPS = math.floor(getCurrentFPS())
dxDrawText(roundedFPS.." FPS", sw-40 - dxGetTextWidth(roundedFPS), 0)
end
end
addEventHandler("onClientHUDRender", root, drawFPS)
function sx(po)
return (po/1680)*sw
end
function sy(po)
return (po/1050)*sh
end
local font=exports["srpg-gui"]:czcionka(sx(14))
addEventHandler("onClientRender", getRootElement(), function()
if getElementData(localPlayer,"hud:visible") then
local money=convertNumber(getPlayerMoney(localPlayer))
local hp=getElementHealth(localPlayer)
local glod=getElementData(localPlayer,"player:glod") or 0
local time = getRealTime()
local hours = time.hour
local minutes = time.minute
dxDrawImage(sx(1426), sy(14), sx(239), sy(40), ":srpg-hud/i/bg_glod.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(sx(1173), sy(14), sx(239), sy(40), ":srpg-hud/i/bg_zycie.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(sx(1177+197), sy(18), sx(-197)*hp/100, sy(32), ":srpg-hud/i/stanzycie.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(sx(1430+197), sy(18), sx(-197)*glod/100, sy(32), ":srpg-hud/i/stanglod.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
ramka2(sx(1592), sy(67), sx(70), sy(70), exports["srpg-avatars"]:loadAvatar(getElementData(localPlayer,"player:uid")), 0, 0, 0, tocolor(255, 255, 255, 255), false)
shadowText(string.format("%02d", hours)..":"..string.format("%02d",minutes), sx(1388), sy(92), sx(1581), sy(120), tocolor(210, 210, 210, 255), font)
shadowText(money.." PLN", sx(1388), sy(110), sx(1581), sy(138), tocolor(210, 210, 210, 255), font)
end
end)
setTimer(function()
if not getElementData(localPlayer,"player:logged") then return end
setElementData(localPlayer,"player:glod", getElementData(localPlayer,"player:glod")-0.50)
if getElementData(localPlayer, "player:glod") <= 0 then
setElementHealth(localPlayer, getElementHealth(localPlayer)-5)
end
end, 120000, 0)
addEventHandler("onClientElementDataChange", root, function(data, oldValue)
if not getElementData(localPlayer,"player:logged") then return end
if data == "player:glod" then
if getElementData(localPlayer, "player:glod") <= 0 then
setElementHealth(localPlayer, getElementHealth(localPlayer)-5)
end
elseif getElementData(localPlayer, "player:glod") >= 100 then
setElementData(localPlayer, "player:glod", 100)
end
end)
function addElementHealth(element, value)
if not tonumber(value) then return end
local healthElement=getElementHealth(element)
setElementHealth(element, healthElement+value)
end
function ramka2(x, y, w, h, img)
local color2 = tocolor(34, 83, 157)
dxDrawRectangle(x-3, y-3, w+6, h+6, color2, false)
dxDrawImage(x, y, w, h, img, 0, 0, 0, tocolor(255, 255, 255, 255), false)
end
function shadowText(text, x, y, w, h, color, ffont)
dxDrawText(text, x+1, y+1, w+1, h+1, tocolor(0, 0, 0, 255), 1, ffont, "right", "center", false, false, false, false, false)
dxDrawText(text, x, y, w, h, color, 1, ffont, "right", "center", false, false, false, false, false)
end
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