Jump to content

atualizar elementData toda hora


Recommended Posts

Olá, fiz um alteração em uma hud, para mostrar a fome,sede e sono, porem, ela só pega os valores qndo o resource inicia, dps qndo é alterada, ela continua mostrando o msm numero, em vez de atualizar

local Sono = getElementData ( localPlayer, "Sono" )
local Sede = getElementData ( localPlayer, "Sede" )
local Fome = getElementData ( localPlayer, "Fome" )

addEventHandler("onClientRender", root,
    function()
        dxDrawImage(screenW * 0.6332, screenH * 0.0729, screenW * 0.1881, screenH * 0.1068, "images/vida2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(screenW * 0.6523, screenH * 0.1146, screenW * 0.0220, screenH * 0.0313, "images/comida.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(screenW * 0.7577, screenH * 0.1159, screenW * 0.0220, screenH * 0.0299, "images/sono.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText(""..Fome.."", screenW * 0.6772, screenH * 0.1172, screenW * 0.6991, screenH * 0.1458, tocolor(255, 255, 255, 255), 1.30, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText(""..Sede.."", screenW * 0.7255, screenH * 0.1172, screenW * 0.7474, screenH * 0.1458, tocolor(255, 255, 255, 255), 1.30, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText(""..Sono.."", screenW * 0.7826, screenH * 0.1172, screenW * 0.8045, screenH * 0.1458, tocolor(255, 255, 255, 255), 1.30, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawImage(screenW * 0.7035, screenH * 0.1159, screenW * 0.0220, screenH * 0.0299, "images/sede.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    end
)

 

Link to comment
  • Other Languages Moderators

Não use variáveis nesse caso.

addEventHandler ("onClientRender", root, function()
	dxDrawImage (screenW * 0.6332, screenH * 0.0729, screenW * 0.1881, screenH * 0.1068, "images/vida2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawImage (screenW * 0.6523, screenH * 0.1146, screenW * 0.0220, screenH * 0.0313, "images/comida.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawImage (screenW * 0.7035, screenH * 0.1159, screenW * 0.0220, screenH * 0.0299, "images/sede.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawImage (screenW * 0.7577, screenH * 0.1159, screenW * 0.0220, screenH * 0.0299, "images/sono.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawText (getElementData (localPlayer, "Fome").."", screenW * 0.6772, screenH * 0.1172, screenW * 0.6991, screenH * 0.1458, tocolor(255, 255, 255, 255), 1.30, "default-bold", "left", "top", false, false, false, false, false)
	dxDrawText (getElementData (localPlayer, "Sede").."", screenW * 0.7255, screenH * 0.1172, screenW * 0.7474, screenH * 0.1458, tocolor(255, 255, 255, 255), 1.30, "default-bold", "left", "top", false, false, false, false, false)
	dxDrawText (getElementData (localPlayer, "Sono").."", screenW * 0.7826, screenH * 0.1172, screenW * 0.8045, screenH * 0.1458, tocolor(255, 255, 255, 255), 1.30, "default-bold", "left", "top", false, false, false, false, false)
end)

 

  • Thanks 1
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...