Esempio n. 1
0
        private static bool HandleCommandKill(string input)
        {
            if (input == ":all")
            {
                gameServer.KillAllPlayers();
                Log.Write(LogType.Info, "All players were killed!");
            }
            else if (int.TryParse(input, out int playerIndex))
            {
                if (gameServer.KillPlayer((byte)playerIndex))
                {
                    Log.Write(LogType.Info, "Player was killed!");
                }
                else
                {
                    Log.Write(LogType.Error, "Player was not found!");
                }
            }
            else
            {
                GameServer.PlayerClient player = gameServer.FindPlayerByUserName(input);
                if (player != null && gameServer.KillPlayer(player.Index))
                {
                    Log.Write(LogType.Info, "Player was killed!");
                }
                else
                {
                    Log.Write(LogType.Error, "Player was not found!");
                }
            }

            return(true);
        }
Esempio n. 2
0
        private static bool HandleCommandKill(string input)
        {
            int playerIndex;

            if (input == ":all")
            {
                gameServer.KillAllPlayers();
                Log.Write(LogType.Info, "All players were killed!");
            }
            else if (int.TryParse(input, out playerIndex))
            {
                if (gameServer.KillPlayer((byte)playerIndex))
                {
                    Log.Write(LogType.Info, "Player was killed!");
                }
                else
                {
                    Log.Write(LogType.Error, "Player was not found!");
                }
            }
            else
            {
                Log.Write(LogType.Error, "You have to specify player index! (or :all to kill all players)");
            }

            return(true);
        }