diff --git a/README.md b/README.md
index 489b5d1..feec916 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
-# DxHUD
+# dx_hud
This started as a fork of Cosmo HUD but ended up being a complete rewrite.
-DxHUD is an HUD for FiveM and ESX Legacy.
+dx_hud is an HUD for FiveM and ESX Legacy.
## Requirements
@@ -15,15 +15,22 @@ DxHUD is an HUD for FiveM and ESX Legacy.
## Useful Snippets
-You may want to set every ped maximum health to the same amount.
-Insert the snippet below in a loop that runs every tick and you're done.
+### I won't provide any support for the snippets below, it's up to you to understand if you need it or not or if you have any conflicts aswell.
+
+If you want to equal health among peds, run this client-side every tick.
```lua
-if GetEntityMaxHealth(ESX.PlayerData.ped) ~= 200 then
- SetEntityMaxHealth(ESX.PlayerData.ped, 200)
- SetEntityHealth(ESX.PlayerData.ped, 200)
+if GetEntityMaxHealth(PlayerPedId()) ~= 200 then
+ SetEntityMaxHealth(PlayerPedId(), 200)
+ SetEntityHealth(PlayerPedId(), 200)
end
```
+If you want to disable health regen, run this client-side every tick.
+```lua
+ SetPlayerHealthRechargeMultiplier(PlayerId(), 0.0)
+ SetPlayerHealthRechargeLimit(PlayerId(), 0.0)
+```
+
## Download & Installation
@@ -58,7 +65,7 @@ ensure dx_hud
Legal Notices |
-DxHUD for ESX Legacy +dx_hud for ESX Legacy Copyright © 2022 [Demxn](https://github.com/0xDEMXN) diff --git a/client.lua b/client.lua index 0349828..d57443b 100644 --- a/client.lua +++ b/client.lua @@ -1,8 +1,8 @@ local playerId = PlayerId() -CreateThread(function() - while true do - if ESX.PlayerLoaded then +local GeneralLoop = function() + CreateThread(function() + while ESX.PlayerLoaded do local ped = PlayerPedId() local underwaterTime = GetPlayerUnderwaterTimeRemaining(playerId) * 10 @@ -33,17 +33,16 @@ CreateThread(function() DisplayRadar(dx.persistentRadar or isDriving) SetRadarZoom(1150) SendNUIMessage({showUi = not IsPauseMenuActive()}) - else - SendNUIMessage({showUi = false}) - end - Wait(dx.generalRefreshRate) - end -end) + Wait(dx.generalRefreshRate) + end + SendNUIMessage({showUi = false}) + end) +end -CreateThread(function() - while true do - if ESX.PlayerLoaded then +local StatusLoop = function() + CreateThread(function() + while ESX.PlayerLoaded do local hunger, thirst, stress = false, false, false local statusReady = false @@ -65,11 +64,11 @@ CreateThread(function() thirst = thirst, stress = dx.showStress and stress, }) - end - Wait(dx.statusRefreshRate) - end -end) + Wait(dx.statusRefreshRate) + end + end) +end if dx.circleMap then CreateThread(function() @@ -83,9 +82,9 @@ if dx.circleMap then SetMinimapComponentPosition('minimap_mask', 'L', 'B', 0.06, 0.05, 0.132, 0.260) SetMinimapComponentPosition('minimap_blur', 'L', 'B', 0.005, -0.01, 0.166, 0.257) - Wait(1000) + Wait(500) SetRadarBigmapEnabled(true, false) - Wait(1000) + Wait(500) SetRadarBigmapEnabled(false, false) local minimap = RequestScaleformMovie("minimap") @@ -107,6 +106,9 @@ end) RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function() ESX.PlayerLoaded = true + GeneralLoop() + StatusLoop() + SendNUIMessage({playerId = GetPlayerServerId(playerId)}) end) RegisterNetEvent('esx:onPlayerLogout') diff --git a/fxmanifest.lua b/fxmanifest.lua index 546dd76..5666612 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,7 +1,10 @@ fx_version 'cerulean' game 'gta5' author '0xDEMXN' -version '1.0.5' +version '1.0.6' + +lua54 'yes' +use_fxv2_oal 'yes' shared_scripts { '@es_extended/imports.lua' @@ -16,7 +19,7 @@ files { 'html/ui.html', 'html/script.js', 'html/style.css', - 'html/loading-bar.js', + 'html/logo.png', } ui_page 'html/ui.html' diff --git a/html/logo.png b/html/logo.png new file mode 100644 index 0000000..d65ea63 Binary files /dev/null and b/html/logo.png differ diff --git a/html/script.js b/html/script.js index 8c13aa3..733bc2e 100644 --- a/html/script.js +++ b/html/script.js @@ -224,9 +224,15 @@ window.addEventListener("message", function (event) { VoiceIndicator.animate(data.voiceRange / 100); } + if (data.playerId) { + document.getElementById("ID").textContent = data.playerId; + } + if (data.showUi == true) { - document.querySelector(".container").style.display = "block"; + document.querySelector(".Container").style.display = "block"; + document.querySelector(".Logo").style.display = "block"; } else if (data.showUi == false) { - document.querySelector(".container").style.display = "none"; + document.querySelector(".Container").style.display = "none"; + document.querySelector(".Logo").style.display = "none"; } }); diff --git a/html/style.css b/html/style.css index 5238eaf..6a93a88 100644 --- a/html/style.css +++ b/html/style.css @@ -40,6 +40,26 @@ body { font-size: .8rem; } +#ID { + color: #fff; + font-size: 1.5rem; + font-family: sans-serif; + font-weight: 700; + height: 2.5rem; + margin: 0 .5rem; + text-shadow: 1px 1px 10px #000; + text-align: center; + line-height: 2.5rem; +} + +.Logo { + position: absolute; + top: 1.5rem; + right: 4rem; + max-width: 130px; + opacity: .7; +} + .flash { -webkit-animation: flash 1s; animation: flash 1s; diff --git a/html/ui.html b/html/ui.html index 4d4d960..ea19d94 100644 --- a/html/ui.html +++ b/html/ui.html @@ -45,9 +45,12 @@ | - + + + +