From: Daniel Karbach Date: Wed, 21 Oct 2015 07:42:41 +0000 (+0200) Subject: server: notify clients of player joins/parts X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=660c4216fc61c0d99987adbfea057af07b511a23;p=blank.git server: notify clients of player joins/parts --- diff --git a/src/server/net.cpp b/src/server/net.cpp index 6ceb186..e739922 100644 --- a/src/server/net.cpp +++ b/src/server/net.cpp @@ -431,12 +431,17 @@ void ClientConnection::AttachPlayer(Player &player) { GetPlayerModel().Instantiate(PlayerEntity().GetModel()); } - cout << "player \"" << player.Name() << "\" joined" << endl; + string msg = "player \"" + player.Name() + "\" joined"; + cout << msg << endl; + server.DistributeMessage(0, 0, msg); } void ClientConnection::DetachPlayer() { if (!HasPlayer()) return; - cout << "player \"" << input->GetPlayer().Name() << "\" left" << endl; + string msg = "player \"" + input->GetPlayer().Name() + "\" left"; + cout << msg << endl; + server.DistributeMessage(0, 0, msg); + server.GetWorldSave().Write(input->GetPlayer()); PlayerEntity().Kill(); PlayerEntity().UnRef();