コード例 #1
0
        public void CMD_RemovePlayerFromGameMode(Client client, uint gmId, string playerFirstName, string playerSecondName = "")
        {
            Client player = ServerUtilities.GetPlayerIfExists(client, playerFirstName, playerSecondName);

            if (player == null)
            {
                return;
            }

            try
            {
                BaseGameMode gameMode = GameModeHandler.Instance.GetGameModeById(gmId);
                gameMode.RemovePlayer(player);
                Main.Logger.LogClient(gameMode.GetGameModeData().EventHost, $"{client.Name} joined the event ({gameMode.GetGameModeData().Id}) {gameMode.GetGameModeData().Name}.");
                Main.Logger.LogClient(player, $"You were added to the event ({gameMode.GetGameModeData().Id}) {gameMode.GetGameModeData().Name} by {client.Name}.");
            }
            catch (Exception e)
            {
                Main.Logger.LogClient(client, e.Message);
            }
        }