From b96a206dc350c1fdac0fdef1c11fea5907e3f509 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 25 Oct 2010 11:17:17 +0200 Subject: [PATCH] Core/Scripts: Moved OnPlayerLogout hook call before removing player, fixes crashes in scripts using this hook --HG-- branch : trunk --- src/server/game/Server/WorldSession.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index a03c3570b4..55d1b7cdb6 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -447,6 +447,9 @@ void WorldSession::LogoutPlayer(bool Save) sSocialMgr.SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUIDLow(), true); sSocialMgr.RemovePlayerSocial (_player->GetGUIDLow ()); + // Call script hook before deletion + sScriptMgr.OnPlayerLogout(GetPlayer()); + ///- Remove the player from the world // the player may not be in the world when logging out // e.g if he got disconnected during a transfer to another map @@ -466,7 +469,6 @@ void WorldSession::LogoutPlayer(bool Save) CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = '%u'", GetAccountId()); sLog.outDebug("SESSION: Sent SMSG_LOGOUT_COMPLETE Message"); - sScriptMgr.OnPlayerLogout(GetPlayer()); } m_playerLogout = false;