From 49df6f2bd654d13f0259c656ef61e433e5fa9485 Mon Sep 17 00:00:00 2001 From: Karl Date: Sun, 18 Jul 2021 19:08:48 +0300 Subject: [PATCH] QBHud.ExtraInfo config option Added option to toggle extrainfo on top of HUD (time, money, location, heading, playerid) from config.lua --- qb-hud-redux-lite/client/main.lua | 9 +++++++++ qb-hud-redux-lite/config.lua | 2 +- qb-hud-redux-lite/html/css/main.css | 2 ++ qb-hud-redux-lite/html/js/app.js | 13 +++++++++++++ qb-hud-redux/client/main.lua | 9 +++++++++ qb-hud-redux/config.lua | 2 +- qb-hud-redux/html/css/main.css | 2 ++ qb-hud-redux/html/js/app.js | 15 ++++++++++++++- 8 files changed, 51 insertions(+), 3 deletions(-) diff --git a/qb-hud-redux-lite/client/main.lua b/qb-hud-redux-lite/client/main.lua index 306d6e4..0e59951 100644 --- a/qb-hud-redux-lite/client/main.lua +++ b/qb-hud-redux-lite/client/main.lua @@ -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 @@ -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) diff --git a/qb-hud-redux-lite/config.lua b/qb-hud-redux-lite/config.lua index 3fc654d..c2f8dc9 100644 --- a/qb-hud-redux-lite/config.lua +++ b/qb-hud-redux-lite/config.lua @@ -1,7 +1,7 @@ QBHud = {} -QBHud.Show = false QBHud.MPH = false +QBHud.ExtraInfo = false QBHud.Money = {} QBHud.Money.ShowConstant = false -- Show money constantly diff --git a/qb-hud-redux-lite/html/css/main.css b/qb-hud-redux-lite/html/css/main.css index 6d6889d..e2472a1 100644 --- a/qb-hud-redux-lite/html/css/main.css +++ b/qb-hud-redux-lite/html/css/main.css @@ -203,6 +203,7 @@ p { overflow:hidden; font-family: 'Share Tech Mono', monospace; text-transform: uppercase; + display: none; } .street1 { @@ -237,6 +238,7 @@ p { overflow:hidden; font-family: 'Share Tech Mono', monospace; text-transform: uppercase; + display: none; } .time { diff --git a/qb-hud-redux-lite/html/js/app.js b/qb-hud-redux-lite/html/js/app.js index 70b6869..4cb96cd 100644 --- a/qb-hud-redux-lite/html/js/app.js +++ b/qb-hud-redux-lite/html/js/app.js @@ -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"); @@ -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; diff --git a/qb-hud-redux/client/main.lua b/qb-hud-redux/client/main.lua index b98f179..5c86201 100644 --- a/qb-hud-redux/client/main.lua +++ b/qb-hud-redux/client/main.lua @@ -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 @@ -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) diff --git a/qb-hud-redux/config.lua b/qb-hud-redux/config.lua index 3fc654d..c2f8dc9 100644 --- a/qb-hud-redux/config.lua +++ b/qb-hud-redux/config.lua @@ -1,7 +1,7 @@ QBHud = {} -QBHud.Show = false QBHud.MPH = false +QBHud.ExtraInfo = false QBHud.Money = {} QBHud.Money.ShowConstant = false -- Show money constantly diff --git a/qb-hud-redux/html/css/main.css b/qb-hud-redux/html/css/main.css index 4b1c4b1..6f3e7ba 100644 --- a/qb-hud-redux/html/css/main.css +++ b/qb-hud-redux/html/css/main.css @@ -203,6 +203,7 @@ p { overflow:hidden; font-family: 'Share Tech Mono', monospace; text-transform: uppercase; + display: none; } .street1 { @@ -237,6 +238,7 @@ p { overflow:hidden; font-family: 'Share Tech Mono', monospace; text-transform: uppercase; + display: none; } .time { diff --git a/qb-hud-redux/html/js/app.js b/qb-hud-redux/html/js/app.js index 51d7a88..4cb96cd 100644 --- a/qb-hud-redux/html/js/app.js +++ b/qb-hud-redux/html/js/app.js @@ -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"); @@ -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; @@ -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: