Esempio n. 1
0
    public override void ClientJoined(Client cl)
    {
        base.ClientJoined(cl);
        var player = new DeathmatchPlayer();

        cl.Pawn = player;
        player.Respawn();
    }
        void CheckScores(DeathmatchPlayer player = null, bool timelimit = false)
        {
            if (gameEnding)
            {
                return;
            }
            if (player != null)
            {
                if (Scorelimit > 0 && player.kills >= Scorelimit)
                {
                    Winner(player.player);
                    return;
                }
            }
            if (DeathmatchPlayers.Count == 0)
            {
                gameEnding = true;
                EventManager.BroadcastToChat(EventMessageNoMorePlayers);
                EventManager.CloseEvent();
                EventManager.EndEvent();
                return;
            }
            if (DeathmatchPlayers.Count == 1)
            {
                Winner(DeathmatchPlayers[0].player);
                return;
            }

            if (timelimit)
            {
                BasePlayer winner = null;
                int        score  = 0;
                foreach (var dmPlayer in DeathmatchPlayers)
                {
                    if (dmPlayer.kills > score)
                    {
                        winner = dmPlayer.player;
                        score  = dmPlayer.kills;
                    }
                }
                if (winner != null)
                {
                    Winner(winner);
                }
                return;
            }
        }
Esempio n. 3
0
        void CheckScores(DeathmatchPlayer player = null, bool timelimit = false)
        {
            if (isEnding)
            {
                return;
            }
            if (player != null)
            {
                if (scoreLimit > 0 && player.kills >= scoreLimit)
                {
                    Winner(player.player);
                    return;
                }
            }
            if (eventPlayers.Count == 0)
            {
                isEnding = true;
                EventManager.BroadcastToChat("");
                EventManager.CloseEvent();
                EventManager.EndEvent();
                return;
            }
            if (eventPlayers.Count == 1)
            {
                Winner(eventPlayers[0].player);
                return;
            }

            if (timelimit)
            {
                BasePlayer winner = null;
                int        score  = 0;
                foreach (var dmPlayer in eventPlayers)
                {
                    if (dmPlayer.kills > score)
                    {
                        winner = dmPlayer.player;
                    }
                }
                if (winner != null)
                {
                    Winner(winner);
                }
                return;
            }
        }
Esempio n. 4
0
 private string PlayerMsg(int key, DeathmatchPlayer player) => $"|  <color=#FF8C00>{key}</color>.  <color=#FF8C00>{player.player.displayName}</color> <color=#939393>--</color> <color=#FF8C00>{player.kills}</color>  |";