mirror of
https://github.com/Michatec/xhud.git
synced 2026-03-31 23:46:29 +02:00
Players Online Stats added and some bugfixes
This commit is contained in:
@@ -5,8 +5,10 @@ window.onload = (event) => {
|
||||
fetch(`https://${GetParentResourceName()}/nuiReady`);
|
||||
|
||||
const Container = document.getElementById("Container");
|
||||
const TopRight = document.getElementById("TopRight");
|
||||
const Logo = document.getElementById("Logo");
|
||||
const ID = document.getElementById("ID");
|
||||
const PlayerCount = document.getElementById("PlayerCount");
|
||||
|
||||
const Speed = document.getElementById("SpeedIndicator");
|
||||
const Fuel = document.getElementById("FuelIndicator");
|
||||
@@ -73,13 +75,13 @@ window.onload = (event) => {
|
||||
case "bottom":
|
||||
default:
|
||||
IconsContainer.style.top = "auto";
|
||||
IconsContainer.style.bottom = "20px";
|
||||
IconsContainer.style.bottom = "10px";
|
||||
break;
|
||||
}
|
||||
|
||||
switch (hPosition) {
|
||||
case "left":
|
||||
IconsContainer.style.left = "220px";
|
||||
IconsContainer.style.left = "300px";
|
||||
IconsContainer.style.right = "auto";
|
||||
IconsContainer.style.transform = vPosition === "middle" ? "translate(0, -50%)" : "";
|
||||
break;
|
||||
@@ -102,6 +104,7 @@ window.onload = (event) => {
|
||||
}
|
||||
|
||||
if (action == "setPlayerId") {
|
||||
TopRight.style.display = "flex";
|
||||
if (data) {
|
||||
ID.style.display = "block";
|
||||
ID.textContent = "#" + data;
|
||||
@@ -110,6 +113,16 @@ window.onload = (event) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (action == "setPlayerCount") {
|
||||
TopRight.style.display = "flex";
|
||||
if (data != null && data >= 1) {
|
||||
PlayerCount.style.display = "block";
|
||||
PlayerCount.textContent = data + " Players";
|
||||
} else {
|
||||
PlayerCount.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
if (action == "setHealth") {
|
||||
Health.style.display = "block";
|
||||
|
||||
@@ -227,6 +240,8 @@ window.onload = (event) => {
|
||||
|
||||
if (action == "setVoice") {
|
||||
Voice.style.display = "block";
|
||||
TopRight.style.display = "flex";
|
||||
|
||||
if (data == "disconnected") {
|
||||
VoiceIcon.classList.remove("fa-microphone");
|
||||
VoiceIcon.classList.add("fa-times");
|
||||
|
||||
Reference in New Issue
Block a user