Add new utils

This commit is contained in:
Vortrex
2020-12-21 22:54:32 -06:00
parent bcf06632b3
commit dc01876de2

View File

@@ -1717,4 +1717,33 @@ function arrayBufferToString(arrayBuffer) {
function getClientDisplayForConsole(client) {
return `${client.name}[${client.index}]`;
}
}
// ----------------------------------------------------------------------------
function getBoolRedGreenInlineColour(boolVal) {
return (!boolVal) ? getColourByName("softRed") : getColourByName("softGreen");
}
// ----------------------------------------------------------------------------
function updatePlayerNameTag(client) {
triggerNetworkEvent("ag.nametag", null, client.name, getPlayerNameForNameTag(client), getPlayerColour(client), false, client.ping);
}
// ----------------------------------------------------------------------------
function getPlayerNameForNameTag(client) {
if(isPlayerSpawned(client)) {
return `${getClientCurrentSubAccount(client).firstName} ${getClientCurrentSubAccount(client).lastName}`;
}
return client.name;
}
// ----------------------------------------------------------------------------
function isPlayerSpawned(client) {
return (localPlayer != null);
}
// ----------------------------------------------------------------------------