Save player data on quit

This commit is contained in:
Vortrex
2021-04-18 23:11:11 -05:00
parent 4f1e17825c
commit e6bbfa78df

View File

@@ -60,7 +60,7 @@ function onPlayerJoined(event, client) {
function onPlayerQuit(event, client, quitReasonId) {
logToConsole(LOG_DEBUG, `[Asshat.Event] ${getPlayerDisplayForConsole(client)} disconnected (${disconnectReasons[quitReasonId]}[${quitReasonId}])`);
//savePlayerToDatabase(client);
savePlayerToDatabase(client);
resetClientStuff(client);
getServerData().clients[client.index] = null;
@@ -405,6 +405,9 @@ function onPlayerSpawn(client) {
logToConsole(LOG_DEBUG, `[Asshat.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
updatePlayerHotBar(client);
logToConsole(LOG_DEBUG, `[Asshat.Event] Sending custom keybinds to ${getPlayerDisplayForConsole(client)}`);
sendAccountKeyBindsToClient(client);
logToConsole(LOG_DEBUG, `[Asshat.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
getPlayerData(client).switchingCharacter = false;