Check null client and data for nametag

This commit is contained in:
Vortrex
2022-12-17 14:48:46 -06:00
parent 913e36449a
commit 80795122eb

View File

@@ -80,6 +80,14 @@ function addAllNetworkEventHandlers() {
// =========================================================================== // ===========================================================================
function updatePlayerNameTag(client) { function updatePlayerNameTag(client) {
if (client == null) {
return false;
}
if (getPlayerData(client) == null) {
return false;
}
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`); logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
sendNetworkEventToPlayer("agrp.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client)); sendNetworkEventToPlayer("agrp.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client));
} }
@@ -1323,4 +1331,10 @@ function sendClientVariablesToClient(client) {
sendNetworkEventToPlayer("agrp.cvar", client, JSON.stringify(clientVariables)); sendNetworkEventToPlayer("agrp.cvar", client, JSON.stringify(clientVariables));
} }
// ==========================================================================
function requestPlayerToken(client) {
sendNetworkEventToPlayer("agrp.token", client);
}
// ========================================================================== // ==========================================================================