Ejemplo n.º 1
0
        private void ServerHooks_Join(int ply, HandledEventArgs args)
        {
            var tPlayer = TShock.Players[ply];
            var player  = new ExtendedTSPlayer(tPlayer);

            Players[ply] = player;

            PrisonManager prisonManager = new PrisonManager(TShock.DB);

            if (prisonManager.IPInPrison(player.Player.IP))
            {
                player.PrisonRecord = prisonManager.GetPrisonRecordByIP(player.Player.IP);
            }
        }
Ejemplo n.º 2
0
        private void ServerHooks_Join(int ply, HandledEventArgs args)
        {
            var tPlayer = TShock.Players[ply];
            var player = new ExtendedTSPlayer(tPlayer);

            Players[ply] = player;

            PrisonManager prisonManager = new PrisonManager(TShock.DB);

            if (prisonManager.IPInPrison(player.Player.IP))
            {
                player.PrisonRecord = prisonManager.GetPrisonRecordByIP(player.Player.IP);
            }
        }
Ejemplo n.º 3
0
        public static void SendToPrison(CommandArgs args)
        {
            if (args.Parameters.Count < 2 || args.Parameters.Count > 2)
            {
                args.Player.SendMessage("Invalid syntax! Proper syntax: /sendtoprison <player> <minutes>", Color.Red);
                return;
            }

            var player = TShock.Utils.FindPlayer(args.Parameters[0]);

            if (player == null || player.Count == 0)
            {
                args.Player.SendMessage("No player matched your query.", Color.Red);
                return;
            }

            if (player.Count > 1)
            {
                args.Player.SendMessage("More than one player matched your query.", Color.Red);
                return;
            }

            int minutes = args.Parameters[1].ToIntegerOrDefault(-1);

            if (minutes < 1)
            {
                args.Player.SendMessage("Invalid number of minutes.", Color.Red);
                return;
            }

            ExtendedTSPlayer ePlayer = ExtendedAdmin.Players[player[0].Index];

            PrisonManager manager = new PrisonManager(TShock.DB);

            manager.AddPrisonRecord(player[0], DateTime.Now.AddMinutes(minutes));

            ServerPointSystem.ServerPointSystem.Deduct(new CommandArgs("deduct", player[0], new List <string>()
            {
                player[0].Name,
                ExtendedAdmin.Config.PrisonShards.ToString()
            }));

            UpdateGroup(player[0], player[0].UserAccountName, ExtendedAdmin.Config.PrisonGroup);

            ePlayer.PrisonRecord = manager.GetPrisonerUser(player[0].UserAccountName);

            var warp = TShock.Warps.FindWarp(ExtendedAdmin.Config.PrisonWarp);

            if (warp.WarpPos != Vector2.Zero)
            {
                player[0].Teleport((int)warp.WarpPos.X, (int)warp.WarpPos.Y + 3);
            }
            else
            {
                player[0].Spawn();
            }

            args.Player.SendMessage("Player sent to prison.", Color.Green);
            player[0].SendMessage(string.Format("You have been sent to prison for {0} minute(s)", minutes), Color.Red);
            TShock.Utils.Broadcast(string.Format("{0} has been sent to prison!", player[0].Name), Color.Goldenrod);
        }