Core/Scripts: Moved OnPlayerLogout hook call before removing player, fixes crashes in scripts using this hook

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-10-25 11:17:17 +02:00
parent 42065a236e
commit b96a206dc3
+3 -1
View File
@@ -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;