public static void OnPlayerLeft(Player player, ServerSlot slot, bool announced) { player.Active = false; if (announced) { ProgramLog.Users.Log("{0} @ {1}: LEAVE {2}", slot.remoteAddress, slot.whoAmI, player.Name); var msg = NetMessage.PrepareThreadInstance(); msg.SynchBegin(player.whoAmi, 0 /*inactive*/); if (player.DisconnectReason != null) { msg.PlayerChat(255, string.Concat(player.Name, " disconnected (", player.DisconnectReason, ")."), 255, 165, 0); } else { msg.PlayerChat(255, string.Concat(player.Name, " has left."), 255, 240, 20); } msg.BroadcastExcept(player.whoAmi); } var ctx = new HookContext { Player = player, Sender = player, }; var args = new HookArgs.PlayerLeftGame { Slot = slot.whoAmI, }; HookPoints.PlayerLeftGame.Invoke(ref ctx, ref args); }
public static void OnPlayerLeft(Player player, ServerSlot slot, bool announced) { player.Active = false; if (announced) { ProgramLog.Users.Log ("{0} @ {1}: LEAVE {2}", slot.remoteAddress, slot.whoAmI, player.Name); var msg = NetMessage.PrepareThreadInstance(); msg.SynchBegin (player.whoAmi, 0 /*inactive*/); if (player.DisconnectReason != null) msg.PlayerChat (255, string.Concat (player.Name, " disconnected (", player.DisconnectReason, ")."), 255, 165, 0); else msg.PlayerChat (255, string.Concat (player.Name, " has left."), 255, 240, 20); msg.BroadcastExcept (player.whoAmi); } var ctx = new HookContext { Player = player, Sender = player, }; var args = new HookArgs.PlayerLeftGame { Slot = slot.whoAmI, }; HookPoints.PlayerLeftGame.Invoke (ref ctx, ref args); }
public static void OnPlayerLeft(Player player, ServerSlot slot, bool announced) { player.Active = false; if (announced) { ProgramLog.Users.Log ("{0} @ {1}: LEAVE {2}", slot.remoteAddress, slot.whoAmI, player.Name); var msg = NetMessage.PrepareThreadInstance(); msg.SynchBegin (player.whoAmi, 0 /*inactive*/); if (player.DisconnectReason != null) msg.PlayerChat (255, string.Concat (player.Name, " disconnected (", player.DisconnectReason, ")."), 255, 165, 0); else msg.PlayerChat (255, string.Concat (player.Name, " has left."), 255, 240, 20); msg.BroadcastExcept (player.whoAmi); } PlayerLogoutEvent Event = new PlayerLogoutEvent(); Event.Slot = null; Event.Sender = player; Program.server.PluginManager.processHook(Plugin.Hooks.PLAYER_LOGOUT, Event); }