Example #1
0
            public void ScorePlayerKill(BasePlayer victim, HitInfo hitInfo)
            {
                IemUtils.GLog("player died in game phase, calculate new score");

                if (victim.ToPlayer() != null)
                {
                    IemUtils.GLog("player died - hook called");
                    BasePlayer player = victim.ToPlayer();

                    if (hitInfo?.Initiator != null &&
                        hitInfo?.Initiator?.ToPlayer() != null &&
                        victim.ToPlayer() != null)
                    {
                        IemUtils.GLog("found player hit, found player scoring kill");
                        //       PlayerDying(player, info);
                        IemUtils.IIemTeamPlayer iemTeamPlayer = GetIemPlayerById(victim.UserIDString);
                        if (iemTeamPlayer != null)
                        {
                            IemUtils.GLog("incrementing score");
                            GetIemPlayerById(hitInfo?.Initiator?.ToPlayer().UserIDString).Score      += 1;
                            GetIemPlayerById(hitInfo?.Initiator?.ToPlayer().UserIDString).Team.Score += 1;
                        }
                    }
                }
            }
Example #2
0
            public void AddPlayer(IemUtils.IIemTeamPlayer player)
            {
                if (player.Team != null && player.Team != this)
                {
                    me.Puts("removing palyer from team " + player.Team.Name);
                    player.Team.RemovePlayer(player);
                }

                if (!Players.ContainsKey(player.PlayerId))
                {
                    Players.Add(player.PlayerId, player);
                }

                player.Team     = this;
                player.TeamGame = TeamGame;

                if (!TeamGame.Players.ContainsKey(player.PlayerId))
                {
                    TeamGame.Players.Add(player.PlayerId, player);
                }

                if (Players.Count > 0)
                {
                    State = IemUtils.TeamState.Before;
                }
            }
Example #3
0
            public void RemovePlayer(IemUtils.IIemTeamPlayer player)
            {
                if (Players.ContainsKey(player.PlayerId))
                {
                    Players.Remove(player.PlayerId);
                }
                player.Team = null;

                if (Players.Count == 0)
                {
                    State = IemUtils.TeamState.Empty;
                }
            }