From b5e898a608cfa0b872828db842e31ec2d624e598 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 3 Feb 2014 21:12:44 +0000 Subject: Server now handles join messages also * Revised as well hook documentation --- src/Entities/Player.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/Entities') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 8c37fdc8d..a1c942c20 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -130,7 +130,13 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) cPlayer::~cPlayer(void) { - cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this); + if (!cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this)) + { + AString DisconnectMessage; + AppendPrintf(DisconnectMessage, "%s[LEAVE] %s%s has left the game", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), GetClientHandle()->GetUsername().c_str()); + cRoot::Get()->BroadcastChat(DisconnectMessage); + LOGINFO("Player %s has left the game.", GetClientHandle()->GetUsername().c_str()); + } LOGD("Deleting cPlayer \"%s\" at %p, ID %d", m_PlayerName.c_str(), this, GetUniqueID()); -- cgit v1.2.3