roaddog Posted July 7, 2014 Share Posted July 7, 2014 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 ) Link to comment
Arnold-1 Posted July 7, 2014 Share Posted July 7, 2014 make the size as a variable, then you can control it as you want. Link to comment
roaddog Posted July 7, 2014 Author Share Posted July 7, 2014 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) Well i use custom timer so, I need help with how the rectangle always fills the full bar. ty Link to comment
Arnold-1 Posted July 7, 2014 Share Posted July 7, 2014 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. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now