I´m not sure about this but wouldn´t this register the draw function again and again? Since the draw function is called every frame this would get very expensive soon![]()
local health
graphics.addDrawFunc("draw()", 0)
function drawHealthBar()
health = (Values["MC_health"].Int / 100) * 300
-- + --
function draw() graphics.drawBox(200, 200, health, 40, 0x0000ff, 1) end
end
registerEventHandler("mainLoop", "drawHealthBar")
I´m not sure about this but wouldn´t this register the draw function again and again? Since the draw function is called every frame this would get very expensive soon
It doesn't really matter, you are just replacing the draw function inside of the table, but you can create the function that registers the draw function outside of the loop.Something along the lines of this...local health graphics.addDrawFunc("draw()", 0) function drawHealthBar() health = (Values["MC_health"].Int / 100) * 300 -- + -- function draw() graphics.drawBox(200, 200, health, 40, 0x0000ff, 1) end end registerEventHandler("mainLoop", "drawHealthBar")