Skip to content

Commit

Permalink
QBHud.ExtraInfo config option
Browse files Browse the repository at this point in the history
Added option to toggle extrainfo on top of HUD (time, money, location, heading, playerid) from config.lua
  • Loading branch information
Jakats committed Jul 18, 2021
1 parent cf40495 commit 49df6f2
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 3 deletions.
9 changes: 9 additions & 0 deletions qb-hud-redux-lite/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ local stamina = 100
local cashAmount = 0
local isLoggedIn = false -- Set to true to debug
local Player = nil
local extraInfo = QBHud.ExtraInfo

local fasttick = 300
local slowtick = 1000
Expand Down Expand Up @@ -145,6 +146,14 @@ Citizen.CreateThread(function()
end
end)

Citizen.CreateThread(function()
Citizen.Wait(1000)
SendNUIMessage({
action = "extras",
extra = extraInfo,
})
end)

Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
Expand Down
2 changes: 1 addition & 1 deletion qb-hud-redux-lite/config.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
QBHud = {}

QBHud.Show = false
QBHud.MPH = false
QBHud.ExtraInfo = false

QBHud.Money = {}
QBHud.Money.ShowConstant = false -- Show money constantly
Expand Down
2 changes: 2 additions & 0 deletions qb-hud-redux-lite/html/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ p {
overflow:hidden;
font-family: 'Share Tech Mono', monospace;
text-transform: uppercase;
display: none;
}

.street1 {
Expand Down Expand Up @@ -237,6 +238,7 @@ p {
overflow:hidden;
font-family: 'Share Tech Mono', monospace;
text-transform: uppercase;
display: none;
}

.time {
Expand Down
13 changes: 13 additions & 0 deletions qb-hud-redux-lite/html/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ var fuelblink = 20;
}
};

QBHud.ExtraHud = function(data) {
if (data.extra) {
$(".locationbar").show();
$(".infobar").show();
} else {
$(".locationbar").hide();
$(".infobar").hide();
}
};

QBHud.UpdateHudSlow = function(data) {
$(".ui-container").css("display", data.show ? "none" : "block");

Expand Down Expand Up @@ -191,6 +201,9 @@ var fuelblink = 20;
case "car":
QBHud.CarHud(event.data);
break;
case "extras":
QBHud.ExtraHud(event.data);
break;
case "seatbelt":
QBHud.ToggleSeatbelt(event.data);
break;
Expand Down
9 changes: 9 additions & 0 deletions qb-hud-redux/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ local stamina = 100
local cashAmount = 0
local isLoggedIn = false
local Player = nil
local extraInfo = QBHud.ExtraInfo

local fasttick = 300
local slowtick = 1000
Expand Down Expand Up @@ -145,6 +146,14 @@ Citizen.CreateThread(function()
end
end)

Citizen.CreateThread(function()
Citizen.Wait(1000)
SendNUIMessage({
action = "extras",
extra = extraInfo,
})
end)

Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
Expand Down
2 changes: 1 addition & 1 deletion qb-hud-redux/config.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
QBHud = {}

QBHud.Show = false
QBHud.MPH = false
QBHud.ExtraInfo = false

QBHud.Money = {}
QBHud.Money.ShowConstant = false -- Show money constantly
Expand Down
2 changes: 2 additions & 0 deletions qb-hud-redux/html/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ p {
overflow:hidden;
font-family: 'Share Tech Mono', monospace;
text-transform: uppercase;
display: none;
}

.street1 {
Expand Down Expand Up @@ -237,6 +238,7 @@ p {
overflow:hidden;
font-family: 'Share Tech Mono', monospace;
text-transform: uppercase;
display: none;
}

.time {
Expand Down
15 changes: 14 additions & 1 deletion qb-hud-redux/html/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ var fuelblink = 20;
}
};

QBHud.ExtraHud = function(data) {
if (data.extra) {
$(".locationbar").show();
$(".infobar").show();
} else {
$(".locationbar").hide();
$(".infobar").hide();
}
};

QBHud.UpdateHudSlow = function(data) {
$(".ui-container").css("display", data.show ? "none" : "block");

Expand Down Expand Up @@ -191,6 +201,9 @@ var fuelblink = 20;
case "car":
QBHud.CarHud(event.data);
break;
case "extras":
QBHud.ExtraHud(event.data);
break;
case "seatbelt":
QBHud.ToggleSeatbelt(event.data);
break;
Expand All @@ -212,7 +225,7 @@ var fuelblink = 20;
break;
case "voice_level":
switch (event.data.voicelevel) {
case 310:
case 1.0:
voiceLevel = 33;
break;
case 2.3:
Expand Down

0 comments on commit 49df6f2

Please sign in to comment.