Exemple #1
0
 public void OnPlayerDead(UnturnedPlayer player, Vector3 position)
 {
     if (CommandEvent.eventActive)
     {
         var tempCharacterInfoDuplicate = CommandEvent.joinedPlayers.FirstOrDefault(item => item.getSteamID() == player.CSteamID.ToString());
         if (CommandEvent.eventActive && tempCharacterInfoDuplicate != null)
         {
             UnturnedPlayer playerDead = UnturnedPlayer.FromCSteamID(new CSteamID(Convert.ToUInt64(tempCharacterInfoDuplicate.getSteamID())));
             CommandEvent   myEvent    = new CommandEvent();
             myEvent.clearInventory(playerDead);
             tempCharacterInfoDuplicate.setRevived(false);
             tempCharacterInfoDuplicate.setDead(true);
             dealWithWinEvent();
             player.GodMode = true;
         }
         //       int deadCount = 0;
         //See if 1 player is left
         //             for (int x = 0; x < CommandEvent.joinedPlayers.Count(); x++)
         //               {
         //       var playerThatDied = CommandEvent.joinedPlayers.FirstOrDefault(item => item.getSteamID() == player.CSteamID.ToString());
         //      if (playerThatDied != null)
         //         CommandEvent.activePlayers--;
         //                       deadCount++;
     }
     //       Logger.Log("Player Joined Count: " + CommandEvent.joinedPlayers.Count());
     //       Logger.Log("Player Dead Count: " + deadCount);
 }
Exemple #2
0
 public void healAllDead()
 {
     for (int x = 0; x < CommandEvent.joinedPlayers.Count; x++)
     {
         UnturnedPlayer player = UnturnedPlayer.FromCSteamID(new CSteamID(Convert.ToUInt64(CommandEvent.joinedPlayers[x].getSteamID())));
         if (CommandEvent.joinedPlayers[x].getDead())
         {
             CommandEvent myEvent = new CommandEvent();
             myEvent.healPlayer(player);
         }
     }
 }
Exemple #3
0
        private void delayKillPlayer()
        {
            if ((DateTime.Now - this.lastCalled).TotalSeconds > .5)
            {
                lastCalled = DateTime.Now;

                if (playersToKillOnConnect.Count == 1 && playersToKillOnConnect[0] != null)
                {
                    //               playersToKillOnConnect[0].GodMode = false;
                    //              playersToKillOnConnect[0].Suicide();
                    CommandEvent myEvent = new CommandEvent();
                    myEvent.clearInventory(playersToKillOnConnect[0]);
                    UnturnedPlayer playerMove = UnturnedPlayer.FromCSteamID(new CSteamID(Convert.ToUInt64(playersToKillOnConnect[0].CSteamID.ToString())));
                    playersToKillOnConnect[0].Teleport(new Vector3((float)-312.1, (float)72.4, (float)80.0), 0);
                    playersToKillOnConnect.Remove(playersToKillOnConnect[0]);
                }
            }
        }
Exemple #4
0
        private void OnPlayerConnected(UnturnedPlayer player)
        {
            player.GodMode = false;
            Rocket.Core.R.Permissions.RemovePlayerFromGroup("EventGroup", player);
            Rocket.Core.R.Permissions.AddPlayerToGroup("Guest", player);

            var tempCharacterLeftDuringEvent = leftDuringEvent.FirstOrDefault(item => item.getSteamID() == player.CSteamID.ToString());

            leftDuringEvent.Remove(tempCharacterLeftDuringEvent);

            if (tempCharacterLeftDuringEvent != null)
            {
                CommandEvent myEvent = new CommandEvent();
                myEvent.clearInventory(player);
                tempClassPlayer = player;
                playersToKillOnConnect.Add(player);
//                           player.Suicide();
                //  player.Teleport("Seattle");
                //         player.Damage(255, new Vector3(0, 0, 0), EDeathCause.PUNCH, ELimb.SKULL, player.CSteamID);
                UnturnedChat.Say(player, Events.Instance.Translate("events_left_active_event"), Events.Instance.Configuration.Instance.ErrorColor);
            }
        }
Exemple #5
0
        public void dealWithWinEvent()
        {
            //Count and deal with alive people.
            int tempTotalAlive = AliveCount();

            Logger.Log("Alive count: " + tempTotalAlive);

            if (tempTotalAlive == 1)
            {
                var winningPlayer = CommandEvent.joinedPlayers.FirstOrDefault(item => item.getDead() == false);
                winners += winningPlayer.getSteamID() + " ";
                winningPlayer.increaseWins();

                UnturnedPlayer playerWinner = UnturnedPlayer.FromCSteamID(new CSteamID(Convert.ToUInt64(winningPlayer.getSteamID())));
                CommandEvent   myEvent      = new CommandEvent();
                myEvent.clearInventory(playerWinner);
                playerWinner.Damage(255, new Vector3(0, 0, 0), EDeathCause.PUNCH, ELimb.SKULL, playerWinner.CSteamID);
                //                playerWinner.Teleport(CommandEvent.position2, 0);
                //                playerWinner.GodMode = true;
                //                winningPlayer.setDead(true);
                UnturnedChat.Say(Events.Instance.Translate("events_winner_announcement", winningPlayer.getName()), Events.Instance.Configuration.Instance.AnnouncementColor);
                //                    CommandEvent.eventActive = false;
            }
        }