Jump to content

Question.


Recommended Posts

Posted

You can't use the GUI progress bar if you want it to look like that. As Dealman says use the drawing functions, along with some math to make it draw correctly.

Specifically these

dxDrawRectangle 
dxDrawImage 
dxDrawText 

Posted
You can't use the GUI progress bar if you want it to look like that. As Dealman says use the drawing functions, along with some math to make it draw correctly.

Specifically these

dxDrawRectangle 
dxDrawImage 
dxDrawText 

Alright.. how can i make image like this one?

Posted

It's not an image. That progress bar is most likely made out of rectangles only. Basically it's 2 rectangles inside a bigger rectangle. And then to increase the progress, you increase the width of the inner coloured rectangle, not the black one.

Posted
It's not an image. That progress bar is most likely made out of rectangles only. Basically it's 2 rectangles inside a bigger rectangle. And then to increase the progress, you increase the width of the inner coloured rectangle, not the black one.

Alright..what i understand from you now is..it's not an image...so can you give me the functions to edit the progress bar like that?

Posted

Alright..what i understand from you now is..it's not an image...so can you give me the functions to edit the progress bar like that?

dxDrawRectangle 

Edit:

I made a quick image to try to explain it to you visually.

EzUKinF.png

You increase or decrease the width of Rectangle 3 to make it look like it's progressing.

Posted

Alright..what i understand from you now is..it's not an image...so can you give me the functions to edit the progress bar like that?

dxDrawRectangle 

Edit:

I made a quick image to try to explain it to you visually.

EzUKinF.png

You increase or decrease the width of Rectangle 3 to make it look like it's progressing.

ِAlright but...how to +1 the Progress? or even -1

Posted

Say the longest length of rectangle 3 is 100 pixels, this is the length it will be when full.

  
local progress = 1 
x, y = guiGetScreenSize() 
dxDrawRectangle((x/2)-50, y/2, 100, 5, tocolor(0, 255, 0, 100)) 
dxDrawRectangle((x/2)-50, y/2, progress, 5, tocolor(0, 255, 0, 255)) 
  

So you just need to set the progress to whatever number between 0-100 you want it to be. Bear in mind that if your bar is not 100 pixels then you will need to convert the progress into a percentage of whatever the bars full length will be.

Posted
Say the longest length of rectangle 3 is 100 pixels, this is the length it will be when full.
  
local progress = 1 
x, y = guiGetScreenSize() 
dxDrawRectangle((x/2)-50, y/2, 100, 5, tocolor(0, 255, 0, 100)) 
dxDrawRectangle((x/2)-50, y/2, progress, 5, tocolor(0, 255, 0, 255)) 
  

So you just need to set the progress to whatever number between 0-100 you want it to be. Bear in mind that if your bar is not 100 pixels then you will need to convert the progress into a percentage of whatever the bars full length will be.

In this one...the Full Progress is 608!! :/ Much!

local progress = 608 
addEventHandler("onClientRender", root, 
    function() 
        dxDrawRectangle(316, 649, 615, 38, tocolor(13, 115, 0, 255), true) 
        dxDrawRectangle(320, 653, 605, 29, tocolor(0, 0, 0, 255), true) 
        dxDrawRectangle(320, 653, progress, 30, tocolor(229, 0, 0, 200), true) 
    end 
) 
  

I don't need the 608 i want it to be like 100 then full

Posted
local progress = 100 
addEventHandler("onClientRender", root, 
    function() 
        dxDrawRectangle(316, 649, 615, 38, tocolor(13, 115, 0, 255), true) 
        dxDrawRectangle(320, 653, 605, 29, tocolor(0, 0, 0, 255), true) 
        dxDrawRectangle(320, 653, progress*6.08, 30, tocolor(229, 0, 0, 200), true) 
    end 
) 
  

Posted

You increase or decrease the width of Rectangle 3 to make it look like it's progressing.

ِAlright but...how to +1 the Progress? or even -1

sheldon-gif.gif

To simulate there effect that it is increasing or decreasing in progress, you simply increase or decrease the width of the rectangle. Driggero and TAPL gave you good examples. :)

Posted

Bear in mind that if your bar is not 100 pixels then you will need to convert the progress into a percentage of whatever the bars full length will be.

Try something like this:

local progress = 100 
  
local newProgress = progress*6.08 
addEventHandler("onClientRender", root, 
    function() 
        dxDrawRectangle(316, 649, 615, 38, tocolor(13, 115, 0, 255), true) 
        dxDrawRectangle(320, 653, 605, 29, tocolor(0, 0, 0, 255), true) 
        dxDrawRectangle(320, 653, newprogress, 30, tocolor(229, 0, 0, 200), true) 
    end 
) 

EDIT: Just now noticed TAPL's post which is essentially doing the exact same thing, feel free to ignore this

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