Jump to content

Centralizar Scoreboard


Recommended Posts

Alguem Sabe Como Posso Centralizar Essa Scoreboard No Meio da Tela

local screenW, screenH = guiGetScreenSize()
local resW, resH = 1920, 1080
local x, y = (screenW/resW), (screenH/resH)

function DiasSCR()
    -----//VÁRIAVEIS LOCAIS\\-----
    local vida = getElementHealth(localPlayer)
	local colete = getPedArmor(localPlayer)
    local money = convertNumber(getPlayerMoney(getLocalPlayer()))
    local sujo = convertNumber(getElementData(localPlayer, "Dinheiro_Sujo") or "Não possuí!")
    local bpoints = convertNumber(getElementData(localPlayer, "Biticoin_MTA") or "Não possuí!")
    local bank = getElementData ( localPlayer, "Bank_Money") or 0
    local job = getElementData (localPlayer,"Emprego") or "Desempregado"
    local fome = getElementData ( localPlayer, "Fome" ) or 60
    local sede = getElementData ( localPlayer, "Sede" ) or 60
    
    -----//INTERFACE\\-----
    
    dxDrawImage(x*20, y*216, x*519, y*599, "files/img/fundo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- IMG FUNDO
    dxDrawImage(x*219, y*222, x*121, y*121, "files/img/logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- IMG FUNDO
    dxDrawImage(x*185, y*372, x*28, y*28, "files/img/vida.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) -- IMG VIDA
    dxDrawImage(x*185, y*432, x*28, y*28, "files/img/colete.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) -- IMG COLETE
    dxDrawImage(x*185, y*492, x*28, y*28, "files/img/fome.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) -- IMG FOME
    dxDrawImage(x*185, y*550, x*32, y*32, "files/img/sede.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) -- IMG SEDE
    dxDrawImage(x*35, y*626, x*30, y*30, "files/img/money.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) -- IMG MONEY
    dxDrawImage(x*35, y*689, x*30, y*30, "files/img/bank.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) -- IMG BANK
    dxDrawImage(x*291, y*626, x*30, y*30, "files/img/sujo.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) -- IMG SUJO
    dxDrawImage(x*291, y*689, x*30, y*30, "files/img/bpoints.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) -- IMG BPOINTS
    dxDrawImage(x*164, y*765, x*30, y*30, "files/img/maleta.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) -- IMG EMPREGO

    dxDrawRoundedRectangle(x*180, y*361, x*200/100*vida, y*50, tocolor(205, 65, 65, 255), 5) -- RECTANGLE VIDA
    dxDrawRoundedRectangle(x*180, y*421, x*200/100*colete, y*50, tocolor(105, 115, 125, 255), 5) -- RECTANGLE COLETE
    dxDrawRoundedRectangle(x*180, y*481, x*200/100*fome, y*50, tocolor(205, 140, 65, 255), 5) -- RECTANGLE FOME
    dxDrawRoundedRectangle(x*180, y*541, x*200/100*sede, y*50, tocolor(65, 120, 205, 255), 5) -- RECTANGLE SEDE

    dxDrawText("R$: "..money, x*324, y*616, x*528, y*664, tocolor(255, 255, 255, 255), y*1.50, "default-bold", "center", "center", false, false, true, false, false)
    dxDrawText("R$: "..bank, x*324, y*679, x*528, y*727, tocolor(255, 255, 255, 255), y*1.50, "default-bold", "center", "center", false, false, true, false, false)
    dxDrawText("R$: "..sujo, x*71, y*679, x*275, y*727, tocolor(255, 255, 255, 255), y*1.50, "default-bold", "center", "center", false, false, true, false, false)
    dxDrawText("R$: "..bpoints, x*71, y*616, x*275, y*664, tocolor(255, 255, 255, 255), y*1.50, "default-bold", "center", "center", false, false, true, false, false)
    dxDrawText(job, x*197, y*755, x*401, y*803, tocolor(255, 255, 255, 255), y*1.50, "default-bold", "center", "center", false, false, true, false, false)
end

-----//OPEN DX\\-----
local isDXVisible = false
bindKey ("tab", "both", function()
    if isDXVisible then
        removeEventHandler( "onClientRender", root, DiasSCR )
    else
        addEventHandler( "onClientRender", root, DiasSCR )
    end
    isDXVisible = not isDXVisible
end)

-----//CONVERT NUMBER\\-----

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

-----//ARREDONDAR BORDAS\\-----

function dxDrawRoundedRectangle(x, y, rx, ry, color, radius)
    rx = rx - radius * 2
    ry = ry - radius * 2
    x = x + radius
    y = y + radius
    if (rx >= 0) and (ry >= 0) then
        dxDrawRectangle(x, y, rx, ry, color)
        dxDrawRectangle(x, y - radius, rx, radius, color)
        dxDrawRectangle(x, y + ry, rx, radius, color)
        dxDrawRectangle(x - radius, y, radius, ry, color)
        dxDrawRectangle(x + rx, y, radius, ry, color)
        dxDrawCircle(x, y, radius, 180, 270, color, color, 7)
        dxDrawCircle(x + rx, y, radius, 270, 360, color, color, 7)
        dxDrawCircle(x + rx, y + ry, radius, 0, 90, color, color, 7)
        dxDrawCircle(x, y + ry, radius, 90, 180, color, color, 7)
    end
end

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...