Jump to content

dxRectangle


roaddog

Recommended Posts

Posted

Good morning,

Well, I need help, how to make rectangle decrease/increase.

I made this, but it doesnt decrease or increase

function show_time_left( ) 
    if getElementData( localPlayer, "isInTurf" ) and not getElementData( localPlayer, "isInFriendlyTurf" ) then 
        local timeMsg = getElementData( localPlayer, "captureTime" ) 
        local time_to_capture = getElementData(localPlayer, "timeruns") 
        local sx, sy = guiGetScreenSize( ) 
        local resx, resy = 1280, 720 
        if timeMsg and timeMsg ~= "none" then 
        dxDrawText ( timeMsg, (376/resx)*sx, (594/resy)*sy, (1014/resx)*sx, (646/resy)*sy, tocolor( 200, 200, 200, 255 ), (0.8/1366)*sx, (0.8/768)*sy, "bankgothic" ) 
        dxDrawImage((988/resx)*sx, (275/resy)*sy, (275/resx)*sx, (51/resy)*sy, "background.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) 
        dxDrawRectangle((1014/resx)*sx, (285/resy)*sy, (time_to_capture-(51/resy)*sy), (31/resy)*sy, tocolor(254, 254, 254, 171), false) 
        dxDrawText("Capture Time", (1070/resx)*sx, (285/resy)*sy, (1178/resx)*sx, (314/resy)*sy, tocolor(237, 0, 0, 178), (1/1366)*sx, (1/768)*sy, "bankgothic", "center", "center", false, false, true, false, false) 
        end 
    end 
end 
addEventHandler( "onClientRender", root, show_time_left ) 

You gone learn today.

I work my ass off, but I still can't pay tho.

Posted

make the size as a variable, then you can control it as you want.

Ingame Name: Arnold

If you need my help, contact me on Skype @bshr.ara

NOTE:DO NOT ASK ME FOR SCRIPTS, ASK ME FOR HELP

Posted

So I did like this

        local time_lol_lol = tonumber(getElementData(localPlayer, "runrun")) 
dxDrawRectangle((530/resx)*sx, (590/resy)*sy, time_lol_lol, (31/resy)*sy, tocolor(254, 254, 254, 171), false) 
  

2014_07_07_171951.png

Well i use custom timer so, I need help with how the rectangle always fills the full bar. ty

You gone learn today.

I work my ass off, but I still can't pay tho.

Posted

it will work, if "runrun" element data is changing every second.

but you may want to change the variable with a very cool function called interpolateBetween, but personally, i use my own ways.

such as decreasing and increasing the numbers by myself.

Ingame Name: Arnold

If you need my help, contact me on Skype @bshr.ara

NOTE:DO NOT ASK ME FOR SCRIPTS, ASK ME FOR HELP

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