Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sx, sy = guiGetScreenSize()
- local timerTime = 60
- --Start the timer to decrease the time
- function startTimer ()
- timer = setTimer( function ()
- if ( timerTime ~= 0 ) then
- timerTime = timerTime -1
- end
- end, 1000, 0)
- end
- --Stop the timer
- function stopTimer ()
- if ( isTimer(timer) ) then killTimer(timer) end
- end
- -- Show the timer
- function showTimer ()
- addEventHandler( "onClientRender", root, showDxTimer)
- end
- -- Hide the timer
- function hideTimer ()
- removeEventHandler( "onClientRender", root, showDxTimer)
- end
- function showDxTimer ()
- dxDrawRectangle(sx-( sx*(200/1440) ), sy*(400/900), sx*(200/1440), sy*(100/900), tocolor(0, 0, 0, 135))
- dxDrawBorderedRectangle( sx-( sx*(200/1440) ), sy*(400/900), sx*(200/1440), sy*(100/900), tocolor(0, 0, 0, 255), false )
- dxDrawBorderedText ( "Time remaining:\n"..timerTime, sx*(1240/1440) , sy*(400/900) , sx, sy*(500/900), tocolor(255, 255, 255), sx*(1.9/1440), "default-bold", "center", "center")
- end
- -- Function to draw bordered text
- function dxDrawBorderedText ( text, x, y, w, h, color, scale, font, alignX, alignY, borderColor )
- if not ( borderColor ) then borderColor = tocolor ( 0, 0, 0, 255 ) end
- dxDrawText ( text, x - 1, y - 1, w - 1, h - 1, borderColor, scale, font, alignX, alignY, false, false, false, false )
- dxDrawText ( text, x + 1, y - 1, w + 1, h - 1, borderColor, scale, font, alignX, alignY, false, false, false, false )
- dxDrawText ( text, x - 1, y + 1, w - 1, h + 1, borderColor, scale, font, alignX, alignY, false, false, false, false)
- dxDrawText ( text, x + 1, y + 1, w + 1, h + 1, borderColor, scale, font, alignX, alignY, false, false, false, false )
- dxDrawText ( text, x - 1, y, w - 1, h, borderColor, scale, font, alignX, alignY, false, false, false, false)
- dxDrawText ( text, x + 1, y, w + 1, h, borderColor, scale, font, alignX, alignY, false, false, false, false )
- dxDrawText ( text, x, y - 1, w, h - 1, borderColor, scale, font, alignX, alignY, false, false, false, false )
- dxDrawText ( text, x, y + 1, w, h + 1, borderColor, scale, font, alignX, alignY, false, false, false, false )
- dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, false, false, false, false )
- end
- -- Draw bordered rectangle
- function dxDrawBorderedRectangle( x, y, width, height, color, postGUI )
- dxDrawLine ( x, y, x+width, y, color, 1, postGUI or false )
- dxDrawLine ( x, y, x, y+height, color, 1, postGUI or false )
- dxDrawLine ( x, y+height, x+width, y+height, color, 1, postGUI or false )
- dxDrawLine ( x+width, y, x+width, y+height, color, 1, postGUI or false )
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement