]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/player.qc
Merged master.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / player.qc
index 4e8663d24af0a5aaf8b6b3f574fdd9acd9dab8d8..e41bf931b7cf1d1402fcf74aedad0aca9d4193f7 100644 (file)
@@ -235,10 +235,10 @@ void calculate_player_respawn_time(entity this)
        float pcount = 1;  // Include myself whether or not team is already set right and I'm a "player".
        if (teamplay)
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
                        if(it.team == this.team)
                                ++pcount;
-               ));
+               });
                if (sdelay_small_count == 0)
                        sdelay_small_count = 1;
                if (sdelay_large_count == 0)
@@ -246,9 +246,9 @@ void calculate_player_respawn_time(entity this)
        }
        else
        {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA(
+               FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
                        ++pcount;
-               ));
+               });
                if (sdelay_small_count == 0)
                {
                        if (IS_INDEPENDENT_PLAYER(this))
@@ -667,15 +667,19 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        }
 }
 
-void MoveToTeam(entity client, int team_colour, int type)
+bool MoveToTeam(entity client, int team_colour, int type)
 {
        int lockteams_backup = lockteams;  // backup any team lock
        lockteams = 0;  // disable locked teams
        TeamchangeFrags(client);  // move the players frags
-       SetPlayerColors(client, team_colour - 1);  // set the players colour
+       if (!SetPlayerTeamSimple(client, team_colour))
+       {
+               return false;
+       }
        Damage(client, client, client, 100000, DEATH_AUTOTEAMCHANGE.m_id, client.origin, '0 0 0');  // kill the player
        lockteams = lockteams_backup;  // restore the team lock
        LogTeamchange(client.playerid, client.team, type);
+       return true;
 }
 
 /** print(), but only print if the server is not local */