Jump to content

Change DGS Progress Bar Color


Recommended Posts

How do I change these progress bars colors?

healthBar = DGS:dgsCreateProgressBar(0.40, 0.93, 0.2, 0.04, true)
armorBar = DGS:dgsCreateProgressBar(0.40, 0.88, 0.2, 0.04, true)  

function updateBars () 
        local playerHealth = getElementHealth (localPlayer )
        DGS:dgsProgressBarSetProgress(healthBar, playerHealth)

        local playerArmor = getPedArmor(localPlayer)
        DGS:dgsProgressBarSetProgress(armorBar, playerArmor)
end
addEventHandler ( "onClientRender", root, updateBars )

 

Link to comment
7 hours ago, thisdp said:

dgsSetProperty(progressbar,"bgColor",tocolor(r,g,b,a))

dgsSetProperty(progressbar,"indicatorColor",tocolor(r,g,b,a))

healthBar = DGS:dgsCreateProgressBar(0.40, 0.93, 0.2, 0.04, true)
dgsSetProperty(healthBar,"bgColor",tocolor(255, 0, 0, 50))
dgsSetProperty(healthBar,"indicatorColor",tocolor(0, 250, 0, 50))
armorBar = DGS:dgsCreateProgressBar(0.40, 0.88, 0.2, 0.04, true)  
local screenWidth, screenHeight = guiGetScreenSize ( )


function updateBars () 
        local playerHealth = getElementHealth (localPlayer )
        DGS:dgsProgressBarSetProgress(healthBar, playerHealth)

        local playerArmor = getPedArmor(localPlayer)
        DGS:dgsProgressBarSetProgress(armorBar, playerArmor)

        local timehour, timeminute = getTime()
        dxDrawText (timehour.. ":".. timeminute.. "h", 532, screenHeight - 139, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1.5, "pricedown" )
end
addEventHandler ( "onClientRender", root, updateBars )

It is not working. Everything below just stopped working and the bar didn't change colors :/

Link to comment
  • Scripting Moderators

watch your debug message.

about the "DGS" perfix:

DGS = exports.dgs

is always used.

But i recommend you to use this instead

loadstring(exports.dgs:dgsImportFunction())()-- load functions
label = dgsCreateLabel(0,0,0.5,0.1,"text",true) --create a label

 

  • Thanks 1
Link to comment
1 hour ago, thisdp said:

watch your debug message.

about the "DGS" perfix:


DGS = exports.dgs

is always used.

But i recommend you to use this instead


loadstring(exports.dgs:dgsImportFunction())()-- load functions
label = dgsCreateLabel(0,0,0.5,0.1,"text",true) --create a label

 

I don't understand what you said

I have put the DGS = exports.dgs

3 minutes ago, Hugo_Almeidowski said:

I don't understand what you said

I have put the DGS = exports.dgs

Ok I understand now, thanks. I was dumb hehehe

  • Haha 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...