Display disconnect message last + fix radio playing after spawn

This commit is contained in:
Vortrex
2022-08-01 11:34:30 -05:00
parent 8b1fcc1cc1
commit 364e3ef3ab

View File

@@ -109,12 +109,6 @@ function onPlayerQuit(event, client, quitReasonId) {
} }
} }
messageDiscordEventChannel(`👋 ${getPlayerName(client)} has left the server (${reasonText})`);
getClients().forEach(forClient => {
let reasonText = getGroupedLocaleString(forClient, "DisconnectReasons", quitReasonId);
messagePlayerNormal(forClient, getLocaleString(forClient, "PlayerLeftServer", getPlayerName(client), reasonText));
});
//messagePlayerNormal(null, `👋 ${getPlayerName(client)} has left the server (${reasonText})`, getColourByName("softYellow")); //messagePlayerNormal(null, `👋 ${getPlayerName(client)} has left the server (${reasonText})`, getColourByName("softYellow"));
//if (isPlayerFishing(client)) { //if (isPlayerFishing(client)) {
@@ -147,14 +141,20 @@ function onPlayerQuit(event, client, quitReasonId) {
playerInitialized[client.index] = false; playerInitialized[client.index] = false;
playerGUIReady[client.index] = false; playerGUIReady[client.index] = false;
messageDiscordEventChannel(`👋 ${getPlayerName(client)} has left the server (${reasonText})`);
getClients().forEach(forClient => {
let reasonText = getGroupedLocaleString(forClient, "DisconnectReasons", quitReasonId);
messagePlayerNormal(forClient, getLocaleString(forClient, "PlayerLeftServer", getPlayerName(client), reasonText));
});
getServerData().clients[getPlayerId(client)] = null; getServerData().clients[getPlayerId(client)] = null;
} }
// =========================================================================== // ===========================================================================
async function onPlayerChat(event, client, messageText) { async function onPlayerChat(event, client, messageText) {
processPlayerChat(client, messageText);
event.preventDefault(); event.preventDefault();
processPlayerChat(client, messageText);
} }
// =========================================================================== // ===========================================================================
@@ -615,7 +615,7 @@ async function onPlayerSpawn(client) {
// Radio stuff must be last thing sent to client because it hangs the client for a second, which blocks processing of other incoming packets // Radio stuff must be last thing sent to client because it hangs the client for a second, which blocks processing of other incoming packets
// Start playing business/house radio if in one // Start playing business/house radio if in one
if (getPlayerCurrentSubAccount(client).interior != getGameConfig().mainWorldInterior || getPlayerCurrentSubAccount(client).dimension != getGameConfig().mainWorldDimension) { if (getPlayerCurrentSubAccount(client).interior != getGameConfig().mainWorldInterior[getGame()] || getPlayerCurrentSubAccount(client).dimension != getGameConfig().mainWorldDimension[getGame()]) {
let businessId = getPlayerBusiness(client); let businessId = getPlayerBusiness(client);
let houseId = getPlayerHouse(client); let houseId = getPlayerHouse(client);
if (businessId != -1) { if (businessId != -1) {