Version 1.1.0
807 downloads
Released a better version here:
Adds timer bars from GTA V/Online.
Installing
Drop the timerbars folder to your server's client_packages folder, then you can use const barlibrary = require('timerbars'); to add timer bars. (don't forget to check examples)
TimerBar Properties
A timer bar has these properties:
title | Title (left text) of the timer bar. (string)
useProgressBar | Progress bar of the timer bar. If set to true, a progress bar will be drawn instead of right text. (bool)
text | Text (right text) of the timer bar, useless if useProgressBar is true. (string)
progress | Progress of the timer bar, useless if useProgressBar is false. (float between 0.0 - 1.0)
textColor | Text color of the timer bar. (rgba array or HUD color ID)
pbarBgColor | Progress bar's background color. (rgba array or HUD color ID)
pbarFgColor | Progress bar's foreground color. (rgba array or HUD color ID)
visible | Visibility of the timer bar. (bool)
usePlayerStyle | If set to true, timer bar title will be displayed like a GTA Online player name. (bool)
You can check this wiki page for HUD color IDs.
Examples
const timerBarLib = require("timerbars");
// lets create some progress bars
let timeBar = new timerBarLib.TimerBar("TIME LEFT");
timeBar.text = "33:27";
let teamBar = new timerBarLib.TimerBar("TEAM MEMBERS LEFT");
teamBar.text = "4";
let healthBar = new timerBarLib.TimerBar("BOSS HEALTH", true);
healthBar.progress = 0.8;
healthBar.pbarFgColor = [224, 50, 50, 255];
healthBar.pbarBgColor = [112, 25, 25, 255];
let rewardBar = new timerBarLib.TimerBar("REWARD");
rewardBar.text = "$500000";
rewardBar.textColor = [114, 204, 114, 255];
// f7 to toggle visibility of bars
mp.keys.bind(0x76, false, () => {
timeBar.visible = !timeBar.visible;
teamBar.visible = !teamBar.visible;
healthBar.visible = !healthBar.visible;
rewardBar.visible = !rewardBar.visible;
});
// f8 will change health bar's value to something random
mp.keys.bind(0x77, false, () => {
healthBar.progress = Math.random();
});
const timerBarLib = require("timerbars");
let eventTime = new timerBarLib.TimerBar("EVENT TIME LEFT", false);
eventTime.text = "01:40";
let thirdPlace = new timerBarLib.TimerBar("3rd: PlayerName3", false);
thirdPlace.text = "9 kills";
thirdPlace.textColor = 107; // HUD_COLOUR_BRONZE
thirdPlace.usePlayerStyle = true;
let secondPlace = new timerBarLib.TimerBar("2nd: PlayerName2", false);
secondPlace.text = "12 kills";
secondPlace.textColor = 108; // HUD_COLOUR_SILVER
secondPlace.usePlayerStyle = true;
let firstPlace = new timerBarLib.TimerBar("1st: AimbotNub", false);
firstPlace.text = "30 kills";
firstPlace.textColor = 109; // HUD_COLOUR_GOLD
firstPlace.usePlayerStyle = true;