├── README.md ├── client ├── classes │ └── TimerBarBase.lua └── main.lua ├── example.lua └── fxmanifest.lua /README.md: -------------------------------------------------------------------------------- 1 | **CLM ProgressBar - Standalone** 2 | 3 | Hello, today I make available to everyone a port of TimerBar 2 created by Rootcause on RageMP for FiveM. 4 | 5 | Original link: https://github.com/root-cause/ragemp-timerbars 6 | 7 | **Installation** 8 | 9 | 1. Download the script. (https://github.com/Daudeuf/clm_TimerBar) 10 | 2. Extract wherever you want into your resources. 11 | 3. Add `ensure clm_ProgressBar` 12 | 13 | **To use** 14 | 15 | *Example* 16 | ``` 17 | local API_ProgressBar = exports["clm_ProgressBar"]:GetAPI() 18 | 19 | local bar_BarTimerBar 20 | local bar_CheckpointTimerBar 21 | local bar_PlayerTimerBar 22 | local bar_TextTimerBar 23 | 24 | RegisterCommand("example_add", function() 25 | 26 | -- Bar TimerBar 27 | bar_BarTimerBar = API_ProgressBar.add("BarTimerBar", "CAPTURING") 28 | 29 | bar_BarTimerBar.Func.setTitleColor({241, 64, 26, 255}) 30 | bar_BarTimerBar.Func.setHighlightColor({241, 241, 26, 255}) 31 | 32 | bar_BarTimerBar.Func.lib.BarTimerBar.setBackgroundColor({26, 241, 222, 255}) 33 | bar_BarTimerBar.Func.lib.BarTimerBar.setForegroundColor({241, 26, 238, 255}) 34 | 35 | Citizen.CreateThread(function() 36 | local progress = 0.0 37 | 38 | while true do 39 | Citizen.Wait(0) 40 | bar_BarTimerBar.Func.lib.BarTimerBar.setProgress(progress) 41 | progress = progress + 0.001 42 | end 43 | end) 44 | 45 | -- Checkpoint TimerBar 46 | bar_CheckpointTimerBar = API_ProgressBar.add("CheckpointTimerBar", "BASES", nil, 5) 47 | 48 | bar_CheckpointTimerBar.Func.setTitleColor({68, 241, 26, 255}) 49 | bar_CheckpointTimerBar.Func.setHighlightColor({241, 166, 26, 255}) 50 | 51 | bar_CheckpointTimerBar.Func.lib.CheckpointTimerBar.setColor({26, 241, 160, 255}) 52 | bar_CheckpointTimerBar.Func.lib.CheckpointTimerBar.setInProgressColor({114, 26, 241, 255}) 53 | bar_CheckpointTimerBar.Func.lib.CheckpointTimerBar.setFailedColor({241, 26, 26, 255}) 54 | 55 | Citizen.CreateThread(function() 56 | local old = 3 57 | local last = 2 58 | local current = 1 59 | 60 | while true do 61 | Citizen.Wait(1000) 62 | 63 | bar_CheckpointTimerBar.Func.lib.CheckpointTimerBar.setCheckpointState(old, 2) 64 | bar_CheckpointTimerBar.Func.lib.CheckpointTimerBar.setCheckpointState(last, 1) 65 | bar_CheckpointTimerBar.Func.lib.CheckpointTimerBar.setCheckpointState(current, 0) 66 | 67 | old = last 68 | last = current 69 | current = current - 1 70 | if current == 0 then current = 5 end 71 | end 72 | end) 73 | 74 | -- Player TimerBar 75 | bar_PlayerTimerBar = API_ProgressBar.add("PlayerTimerBar", "Clem76", "1st") 76 | 77 | bar_PlayerTimerBar.Func.setTitleColor({241, 199, 26, 255}) 78 | bar_PlayerTimerBar.Func.setHighlightColor({110, 102, 243, 255}) 79 | 80 | -- Text TimerBar 81 | bar_TextTimerBar = API_ProgressBar.add("TextTimerBar", "MAP TIME", "00:08") 82 | 83 | bar_TextTimerBar.Func.setTitleColor({243, 151, 102, 255}) 84 | bar_TextTimerBar.Func.setHighlightColor({243, 243, 102, 255}) 85 | 86 | bar_TextTimerBar.Func.lib.TextTimerBar.setText("N0P3") 87 | bar_TextTimerBar.Func.lib.TextTimerBar.setTextColor({175, 102, 243, 255}) 88 | end) 89 | 90 | RegisterCommand("example_remove_once", function() 91 | API_ProgressBar.remove(bar_PlayerTimerBar._id) 92 | end) 93 | 94 | RegisterCommand("example_remove_all", function() 95 | API_ProgressBar.clear() 96 | end) 97 | ``` 98 | 99 | *API* 100 | ``` 101 | Func.getTitle() -- Return the title 102 | Func.getTitleColor() -- Return the title color 103 | Func.getHighlightColor() -- Return the title highlight color 104 | Func.setTitle(String) -- Set the title 105 | Func.setTitleColor({R, G, B, A}) -- Set the title color 106 | Func.setHighlightColor({R, G, B, A}) -- Set the highlight color 107 | 108 | Func.lib.TextTimerBar.getText() -- Return the text of the bar 109 | Func.lib.TextTimerBar.getTextColor() -- Return the color of the text 110 | Func.lib.TextTimerBar.setText(String) -- Set the text of the bar 111 | Func.lib.TextTimerBar.setTextColor({R, G, B, A}) -- Set the color of the text 112 | 113 | Func.lib.CheckpointTimerBar.getNumCheckpoints() -- Return the quantity of checkpoints 114 | Func.lib.CheckpointTimerBar.getColor() -- Return the base color of a point 115 | Func.lib.CheckpointTimerBar.getInProgressColor() -- Return the InProgress color of a point 116 | Func.lib.CheckpointTimerBar.getFailedColor() -- Return the failed color of a point 117 | Func.lib.CheckpointTimerBar.setColor({R, G, B, A}) -- Set the base color of a point 118 | Func.lib.CheckpointTimerBar.setInProgressColor({R, G, B, A}) -- Set the InProgress color of a point 119 | Func.lib.CheckpointTimerBar.setFailedColor({R, G, B, A}) -- Set the failed color of a point 120 | Func.lib.CheckpointTimerBar.setCheckpointState(Index, State) -- Set the state of a checkpoint [ InProgress = 0, Completed = 1, Failed = 2 ] 121 | Func.lib.CheckpointTimerBar.setAllCheckpointsState(State) -- Set the state of all checkpoints [ InProgress = 0, Completed = 1, Failed = 2 ] 122 | 123 | Func.lib.BarTimerBar.getProgress() -- Return current bar progress percentage 124 | Func.lib.BarTimerBar.getBackgroundColor() -- Return color of bar 125 | Func.lib.BarTimerBar.getForegroundColor() -- Return color of empty bar 126 | Func.lib.BarTimerBar.setProgress(Number) -- Set the current bar progress percentage [ min = 0.0, max = 1.0 ] 127 | Func.lib.BarTimerBar.setBackgroundColor({R, G, B, A}) -- Set the bar color 128 | Func.lib.BarTimerBar.setForegroundColor({R, G, B, A}) -- Set the empty bar color 129 | ``` 130 | -------------------------------------------------------------------------------- /client/classes/TimerBarBase.lua: -------------------------------------------------------------------------------- 1 | exports("TimerBarBase", function(Type, title, text, numCheckpoints) 2 | local CAS = exports["clm_ProgressBar"]:GetCoordsAndSizes() 3 | 4 | local self = { 5 | _Type = Type, 6 | _id = exports["clm_ProgressBar"]:generateRandomString(8), 7 | _thin = false, 8 | _color = {255, 255, 255, 255}, 9 | _inProgressColor = {255, 255, 255, 51}, 10 | _failedColor = {0, 0, 0, 255}, 11 | _checkpointStates = {}, 12 | _numCheckpoints = numCheckpoints ~= nil and exports["clm_ProgressBar"]:clamp(numCheckpoints, 0, 16) or nil, 13 | _title = title or "", 14 | _highlightColor = nil, 15 | _text = text or "", 16 | titleDrawParams = { 17 | font = 0, 18 | color = {240, 240, 240, 255}, 19 | scale = CAS.titleScale, 20 | justification = CAS.textJustification.right, 21 | wrap = CAS.titleWrap 22 | }, 23 | textDrawParams = { 24 | font = 0, 25 | color = {240, 240, 240, 255}, 26 | scale = CAS.textScale, 27 | justification = CAS.textJustification.right, 28 | wrap = CAS.textWrap 29 | }, 30 | CheckpointTimerBar = { 31 | inProgress = 0, 32 | completed = 1, 33 | failed = 2 34 | }, 35 | _bgColor = {155, 155, 155, 255}, 36 | _fgColor = {240, 240, 240, 255}, 37 | _fgWidth = 0.0, 38 | _fgX = 0.0, 39 | progress = 0.0, 40 | Func = {} 41 | } 42 | 43 | self._titleGxtName = "TMRB_TITLE_"..self._id 44 | AddTextEntry(self._titleGxtName, title or "") 45 | self._textGxtName = "TMRB_TEXT_"..self._id 46 | AddTextEntry(self._textGxtName, text or "") 47 | 48 | local Func = { 49 | lib = { 50 | TextTimerBar = { 51 | getText = function() 52 | return self._text 53 | end, 54 | 55 | getTextColor = function() 56 | return self.textDrawParams.color 57 | end, 58 | 59 | setText = function(value) 60 | self._text = value 61 | AddTextEntry(self._textGxtName, value) 62 | end, 63 | 64 | setTextColor = function(value) 65 | self.textDrawParams.color = exports["clm_ProgressBar"]:getColorFromValue(value) 66 | end, 67 | 68 | --setColor = function(value) 69 | -- self.titleColor = value 70 | -- self.textColor = value 71 | --end, 72 | 73 | draw = function(y) 74 | self.Func.draw(y) 75 | 76 | y = y + CAS.textOffset 77 | 78 | exports["clm_ProgressBar"]:drawTextLabel(self._textGxtName, {CAS.initialX, y}, self.textDrawParams) 79 | end, 80 | 81 | resetGxt = function() 82 | -- nope 83 | end 84 | }, 85 | PlayerTimerBar = { 86 | draw = function(y) 87 | self.Func.drawBackground(y) 88 | 89 | local titleDrawParams = self.titleDrawParams 90 | titleDrawParams.scale = CAS.playerTitleScale 91 | 92 | exports["clm_ProgressBar"]:drawTextLabel(self._titleGxtName, {CAS.initialX, y + CAS.playerTitleOffset}, titleDrawParams) 93 | exports["clm_ProgressBar"]:drawTextLabel(self._textGxtName, {CAS.initialX, y + CAS.textOffset}, self.textDrawParams) 94 | end 95 | }, 96 | CheckpointTimerBar = { 97 | getNumCheckpoints = function() 98 | return self._numCheckpoints 99 | end, 100 | 101 | getColor = function() 102 | return self._color 103 | end, 104 | 105 | getInProgressColor = function() 106 | return self._inProgressColor 107 | end, 108 | 109 | getFailedColor = function() 110 | return self._failedColor 111 | end, 112 | 113 | setColor = function(value) 114 | self._color = exports["clm_ProgressBar"]:getColorFromValue(value) 115 | end, 116 | 117 | setInProgressColor = function(value) 118 | self._inProgressColor = exports["clm_ProgressBar"]:getColorFromValue(value) 119 | end, 120 | 121 | setFailedColor = function(value) 122 | self._failedColor = exports["clm_ProgressBar"]:getColorFromValue(value) 123 | end, 124 | 125 | setCheckpointState = function(index, newState) 126 | if index <= 0 or index > self._numCheckpoints then return end 127 | 128 | self._checkpointStates[index] = newState 129 | end, 130 | 131 | setAllCheckpointsState = function(newState) 132 | for i=1, self._numCheckpoints, 1 do 133 | self._checkpointStates[i] = newState 134 | end 135 | end, 136 | 137 | draw = function(y) 138 | self.Func.draw(y) 139 | 140 | y = y + CAS.checkpointOffsetY 141 | local cpX = CAS.checkpointBaseX 142 | 143 | for i=1, self._numCheckpoints, 1 do 144 | local drawColor = self._checkpointStates[i] and (self._checkpointStates[i] == self.CheckpointTimerBar.failed and self._failedColor or self._color) or self._inProgressColor 145 | DrawSprite("timerbars", "circle_checkpoints", cpX, y, CAS.checkpointWidth, CAS.checkpointHeight, 0.0, drawColor[1], drawColor[2], drawColor[3], drawColor[4]) 146 | cpX = cpX - CAS.checkpointOffsetX 147 | end 148 | end 149 | }, 150 | BarTimerBar = { 151 | getProgress = function() 152 | return self._progress 153 | end, 154 | 155 | getBackgroundColor = function() 156 | return self._bgColor 157 | end, 158 | 159 | getForegroundColor = function() 160 | return self._fgColor 161 | end, 162 | 163 | setProgress = function(value) 164 | self._progress = exports["clm_ProgressBar"]:clamp(value, 0.0, 1.0) 165 | self._fgWidth = CAS.progressWidth * self._progress 166 | self._fgX = (CAS.progressBaseX - CAS.progressWidth * 0.5) + (self._fgWidth * 0.5) 167 | end, 168 | 169 | setBackgroundColor = function(value) 170 | self._bgColor = exports["clm_ProgressBar"]:getColorFromValue(value) 171 | end, 172 | 173 | setForegroundColor = function(value) 174 | self._fgColor = exports["clm_ProgressBar"]:getColorFromValue(value) 175 | end, 176 | 177 | draw = function(y) 178 | self.Func.draw(y) 179 | 180 | y = y + CAS.barOffset 181 | 182 | DrawRect(CAS.progressBaseX, y, CAS.progressWidth, CAS.progressHeight, self._bgColor[1], self._bgColor[2], self._bgColor[3], self._bgColor[4]); 183 | DrawRect(self._fgX, y, self._fgWidth, CAS.progressHeight, self._fgColor[1], self._fgColor[2], self._fgColor[3], self._fgColor[4]); 184 | end 185 | } 186 | }, 187 | 188 | getTitle = function() 189 | return self._title 190 | end, 191 | 192 | getTitleColor = function() 193 | return self.titleDrawParams.color 194 | end, 195 | 196 | getHighlightColor = function() 197 | return self._highlightColor 198 | end, 199 | 200 | setTitle = function(value) 201 | self._title = value 202 | AddTextEntry(self._titleGxtName, value) 203 | end, 204 | 205 | setTitleColor = function(value) 206 | self.titleDrawParams.color = exports["clm_ProgressBar"]:getColorFromValue(value) 207 | end, 208 | 209 | setHighlightColor = function(value) 210 | self._highlightColor = value and exports["clm_ProgressBar"]:getColorFromValue(value) or nil 211 | end, 212 | 213 | drawBackground = function(y) 214 | y = y + (self._thin and CAS.bgThinOffset or CAS.bgOffset) 215 | 216 | if self._highlightColor ~= nil then 217 | DrawSprite("timerbars", "all_white_bg", CAS.bgBaseX, y, CAS.timerBarWidth, self._thin and CAS.timerBarThinHeight or CAS.timerBarHeight, 0.0, self._highlightColor[1], self._highlightColor[2], self._highlightColor[3], self._highlightColor[4]) 218 | end 219 | 220 | DrawSprite("timerbars", "all_black_bg", CAS.bgBaseX, y, CAS.timerBarWidth, self._thin and CAS.timerBarThinHeight or CAS.timerBarHeight, 0.0, 255, 255, 255, 140) 221 | end, 222 | 223 | drawTitle = function(y) 224 | exports["clm_ProgressBar"]:drawTextLabel(self._titleGxtName, {CAS.initialX, y}, self.titleDrawParams) 225 | end, 226 | 227 | draw = function(y) 228 | self.Func.drawBackground(y) 229 | self.Func.drawTitle(y) 230 | end, 231 | 232 | InternalDraw = function(y, Type) 233 | if Type == nil then 234 | self.Func.draw(y) 235 | elseif Type == "TextTimerBar" or Type == "PlayerTimerBar" or Type == "CheckpointTimerBar" or Type == "BarTimerBar" then 236 | self.Func.lib[Type].draw(y) 237 | end 238 | end, 239 | 240 | resetGxt = function() 241 | -- nope 242 | end 243 | } 244 | 245 | self.Func = Func 246 | 247 | return self 248 | end) -------------------------------------------------------------------------------- /client/main.lua: -------------------------------------------------------------------------------- 1 | local characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 2 | local textJustification = { 3 | center = 0, 4 | left = 1, 5 | right = 2 6 | } 7 | 8 | function generateRandomString(length) 9 | local result = "" 10 | local length = length or 8 11 | 12 | for i=1, length, 1 do 13 | local I = math.random(#characters) 14 | result = result .. string.sub(characters, I, I) 15 | end 16 | 17 | return result 18 | end 19 | 20 | function clamp(value, min, max) 21 | return math.max(min, math.min(max, value)) 22 | end 23 | 24 | function hideHudComponents() 25 | HideHudComponentThisFrame(6) -- HUD_VEHICLE_NAME 26 | HideHudComponentThisFrame(7) -- HUD_AREA_NAME 27 | HideHudComponentThisFrame(8) -- HUD_VEHICLE_CLASS 28 | HideHudComponentThisFrame(9) -- HUD_STREET_NAME 29 | end 30 | 31 | function getColorFromValue(value) 32 | if type(value) == "table" then 33 | return value 34 | else 35 | local r, g, b, a = getHudColour(value, 0, 0, 0, 0) 36 | return {r, g, b, a} 37 | end 38 | end 39 | 40 | function drawTextLabel(label, position, options) 41 | local font = options.font or 0 42 | local color = options.color or {240, 240, 240, 255} 43 | local scale = options.scale or 0.5 44 | local justification = options.justification or textJustification.center 45 | local wrap = options.wrap or nil 46 | local shadow = options.shadow or nil 47 | local outline = options.outline or nil 48 | 49 | SetTextFont(font) 50 | SetTextScale(0.0, scale) 51 | SetTextColour(color[1], color[2], color[3], color[4]) -- red, green, blue, alpha 52 | SetTextJustification(justification) 53 | 54 | if wrap then 55 | SetTextWrap(0.0, wrap) 56 | end 57 | 58 | if shadow then 59 | SetTextDropShadow() 60 | end 61 | 62 | if outline then 63 | SetTextOutline() 64 | end 65 | 66 | BeginTextCommandDisplayText(label) 67 | EndTextCommandDisplayText(position[1], position[2]) 68 | end 69 | 70 | function GetCoordsAndSizes() 71 | return { 72 | gfxAlignWidth = 0.952, 73 | gfxAlignHeight = 0.949, 74 | 75 | initialX = 0.795, 76 | initialY = 0.923, 77 | initialBusySpinnerY = 0.887, 78 | 79 | bgBaseX = 0.874, 80 | progressBaseX = 0.913, 81 | checkpointBaseX = 0.9445, 82 | 83 | bgOffset = 0.008, 84 | bgThinOffset = 0.012, 85 | textOffset = -0.011, 86 | playerTitleOffset = -0.005, 87 | barOffset = 0.012, 88 | checkpointOffsetX = 0.0094, 89 | checkpointOffsetY = 0.012, 90 | 91 | timerBarWidth = 0.165, 92 | timerBarHeight = 0.035, 93 | timerBarThinHeight = 0.028, 94 | timerBarMargin = 0.0399, 95 | timerBarThinMargin = 0.0319, 96 | 97 | progressWidth = 0.069, 98 | progressHeight = 0.011, 99 | 100 | checkpointWidth = 0.012, 101 | checkpointHeight = 0.023, 102 | 103 | titleScale = 0.288, 104 | titleWrap = 0.867, 105 | textScale = 0.494, 106 | textWrap = 0.95, 107 | playerTitleScale = 0.447, 108 | 109 | textJustification = textJustification 110 | } 111 | end 112 | 113 | exports("generateRandomString", generateRandomString) 114 | exports("clamp", clamp) 115 | exports("hideHudComponents", hideHudComponents) 116 | exports("getColorFromValue", getColorFromValue) 117 | exports("drawTextLabel", drawTextLabel) 118 | exports("GetCoordsAndSizes", GetCoordsAndSizes) 119 | 120 | local timerBarPool = {} 121 | 122 | Citizen.CreateThread(function() 123 | RequestStreamedTextureDict("timerbars", true) 124 | local CAS = GetCoordsAndSizes() 125 | 126 | while true do 127 | local Max = #timerBarPool 128 | 129 | if Max == 0 then 130 | Citizen.Wait(500) 131 | else 132 | Citizen.Wait(0) 133 | 134 | hideHudComponents() 135 | 136 | SetScriptGfxAlign(82, 66) 137 | SetScriptGfxAlignParams(0.0, 0.0, CAS.gfxAlignWidth, CAS.gfxAlignHeight) 138 | 139 | local drawY = BusyspinnerIsOn() and CAS.initialBusySpinnerY or CAS.initialY 140 | 141 | for i=1, Max, 1 do 142 | if timerBarPool[i] then 143 | timerBarPool[i].Func.InternalDraw(drawY, timerBarPool[i]._Type) 144 | drawY = drawY - (timerBarPool[i]._thin and CAS.timerBarThinMargin or CAS.timerBarMargin) 145 | end 146 | end 147 | 148 | ResetScriptGfxAlign() 149 | end 150 | end 151 | end) 152 | 153 | exports("GetAPI", function() 154 | return { 155 | add = function(Type, title, text, numCheckPoints) 156 | local ValidBar = exports["clm_ProgressBar"]:TimerBarBase(Type, title, text, numCheckPoints) 157 | table.insert(timerBarPool, ValidBar) 158 | for i=1, #timerBarPool, 1 do 159 | if timerBarPool[i]._id == ValidBar._id then return timerBarPool[i] end 160 | end 161 | end, 162 | remove = function(_id) 163 | for i=1, #timerBarPool, 1 do 164 | if timerBarPool[i]._id == _id then 165 | timerBarPool[i] = nil 166 | end 167 | end 168 | end, 169 | clear = function() 170 | timerBarPool = {} 171 | end 172 | } 173 | end) -------------------------------------------------------------------------------- /example.lua: -------------------------------------------------------------------------------- 1 | local API_ProgressBar = exports["clm_ProgressBar"]:GetAPI() 2 | 3 | local bar_BarTimerBar 4 | local bar_CheckpointTimerBar 5 | local bar_PlayerTimerBar 6 | local bar_TextTimerBar 7 | 8 | RegisterCommand("example_add", function() 9 | 10 | -- Bar TimerBar 11 | bar_BarTimerBar = API_ProgressBar.add("BarTimerBar", "CAPTURING") 12 | 13 | bar_BarTimerBar.Func.setTitleColor({241, 64, 26, 255}) 14 | bar_BarTimerBar.Func.setHighlightColor({241, 241, 26, 255}) 15 | 16 | bar_BarTimerBar.Func.lib.BarTimerBar.setBackgroundColor({26, 241, 222, 255}) 17 | bar_BarTimerBar.Func.lib.BarTimerBar.setForegroundColor({241, 26, 238, 255}) 18 | 19 | Citizen.CreateThread(function() 20 | local progress = 0.0 21 | 22 | while true do 23 | Citizen.Wait(0) 24 | bar_BarTimerBar.Func.lib.BarTimerBar.setProgress(progress) 25 | progress = progress + 0.001 26 | end 27 | end) 28 | 29 | -- Checkpoint TimerBar 30 | bar_CheckpointTimerBar = API_ProgressBar.add("CheckpointTimerBar", "BASES", nil, 5) 31 | 32 | bar_CheckpointTimerBar.Func.setTitleColor({68, 241, 26, 255}) 33 | bar_CheckpointTimerBar.Func.setHighlightColor({241, 166, 26, 255}) 34 | 35 | bar_CheckpointTimerBar.Func.lib.CheckpointTimerBar.setColor({26, 241, 160, 255}) 36 | bar_CheckpointTimerBar.Func.lib.CheckpointTimerBar.setInProgressColor({114, 26, 241, 255}) 37 | bar_CheckpointTimerBar.Func.lib.CheckpointTimerBar.setFailedColor({241, 26, 26, 255}) 38 | 39 | Citizen.CreateThread(function() 40 | local old = 3 41 | local last = 2 42 | local current = 1 43 | 44 | while true do 45 | Citizen.Wait(1000) 46 | 47 | bar_CheckpointTimerBar.Func.lib.CheckpointTimerBar.setCheckpointState(old, 2) 48 | bar_CheckpointTimerBar.Func.lib.CheckpointTimerBar.setCheckpointState(last, 1) 49 | bar_CheckpointTimerBar.Func.lib.CheckpointTimerBar.setCheckpointState(current, 0) 50 | 51 | old = last 52 | last = current 53 | current = current - 1 54 | if current == 0 then current = 5 end 55 | end 56 | end) 57 | 58 | -- Player TimerBar 59 | bar_PlayerTimerBar = API_ProgressBar.add("PlayerTimerBar", "Clem76", "1st") 60 | 61 | bar_PlayerTimerBar.Func.setTitleColor({241, 199, 26, 255}) 62 | bar_PlayerTimerBar.Func.setHighlightColor({110, 102, 243, 255}) 63 | 64 | -- Text TimerBar 65 | bar_TextTimerBar = API_ProgressBar.add("TextTimerBar", "MAP TIME", "00:08") 66 | 67 | bar_TextTimerBar.Func.setTitleColor({243, 151, 102, 255}) 68 | bar_TextTimerBar.Func.setHighlightColor({243, 243, 102, 255}) 69 | 70 | bar_TextTimerBar.Func.lib.TextTimerBar.setText("N0P3") 71 | bar_TextTimerBar.Func.lib.TextTimerBar.setTextColor({175, 102, 243, 255}) 72 | end) 73 | 74 | RegisterCommand("example_remove_once", function() 75 | API_ProgressBar.remove(bar_PlayerTimerBar._id) 76 | end) 77 | 78 | RegisterCommand("example_remove_all", function() 79 | API_ProgressBar.clear() 80 | end) -------------------------------------------------------------------------------- /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'cerulean' 2 | game 'gta5' 3 | 4 | author 'Clem76' 5 | description 'Port of TimerBar 2 made by Rootcause for RageMP to FiveM' 6 | version '1.0' 7 | 8 | client_scripts { 9 | 'client/main.lua', 10 | 'client/classes/TimerBarBase.lua', 11 | 'example.lua' 12 | } --------------------------------------------------------------------------------