Example #1
0
        public static void Jail_OnCommand(KonsoleCommandEventArgs e)
        {
            if (e.Arguments.Length != 4)
            {
                ShowJailUsage();
                return;
            }

            if (HelperTools.IsNumeric(e.Arguments[1]) &&
                HelperTools.IsNumeric(e.Arguments[2]) &&
                HelperTools.IsNumeric(e.Arguments[3]))
            {
                //Validate player exists
                Character player = GetCharacterByName(e.Arguments[0]);
                if (player == null)
                {
                    Console.WriteLine("Could not find a character with the name: ", e.Arguments[0]);
                    ShowJailUsage();
                    return;
                }

                Jail.JailCharacter(player, int.Parse(e.Arguments[1]), int.Parse(e.Arguments[2]), int.Parse(e.Arguments[3]));
                Console.WriteLine(player.Name, " has been jailed!");

                //Some fun
                //HelperTools.BroadcastToAll("Admin is on a rampage! ", e.Arguments[0], " has been jailed!");

                if (player.Logged)
                {
                    player.SendMessage("You have been jailed!");
                }
            }
            else
            {
                Console.WriteLine("<d> <h> <m> parameters must be numeric");
                ShowJailUsage();
                return;
            }
        }