Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dxTimer = {}
- dxTimer.__index = dxTimer;
- function dxTimer:start( position = 0, end = nil )
- self.Time = position;
- self.Update = setTimer( function()
- self.Time = self.Time + 1;
- if( end and self.Time > end ) then
- self:stop();
- end
- end, 1000, 0 );
- self.Display = true;
- end
- function dxTimer:stop()
- destroyTimer( self.Update );
- self.Display = false;
- end
- function onTimerRender()
- if( dxTimer.Display ) then
- local position = dxTimer.Time;
- dxDrawText( position, sW * 0.5, sH * 0.85, sW * 0.5, sH * 0.85, tocolor( 255, 255, 255, 255 ) );
- end
- end
- --[[
- Now just do: dxTimer:start( [StartTime, EndTime ] );
- - StartTime is the time to start the timer from, its optional, leaving blank will start from 0
- - EndTime is optional if you want the timer to disappear after it reaches a certain value
- Completely remove timer: dxTimer:stop()
- --]]
Add Comment
Please, Sign In to add comment