]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/client/teamplay.qc
more projectile health cvars
[divverent/nexuiz.git] / data / qcsrc / client / teamplay.qc
1 float numteams; // NOTE: This is changed in Sbar_SortFrags, so use it only AFTER that
2 float teamplay;
3 float myteam;
4
5 float TeamByColor(float color)
6 {
7         switch(color)
8         {
9         case COLOR_TEAM1: return 0;
10         case COLOR_TEAM2: return 1;
11         case COLOR_TEAM3: return 2;
12         case COLOR_TEAM4: return 3;
13         default: return 0;
14         }
15 }
16
17 float GetPlayerColorForce(float i)
18 {
19         if(!teamplay)
20                 return 0;
21         else
22                 return stof(getplayerkey(i, "colors")) & 15;
23 }
24
25 float GetPlayerColor(float i)
26 {
27         if not(playerslots[i].gotscores) // unconnected
28                 return COLOR_SPECTATOR;
29         else if(stof(getplayerkey(i, "frags")) == FRAGS_SPECTATOR)
30                 return COLOR_SPECTATOR;
31         else
32                 return GetPlayerColorForce(i);
33 }
34
35 string GetPlayerName(float i)
36 {
37         return ColorTranslateRGB(getplayerkey(i, "name"));
38 }
39
40 vector GetTeamRGB(float color)
41 {
42         switch(color)
43         {
44         default: return '1 1 1';
45         case COLOR_TEAM1: return '1 0 0'; // red
46         case COLOR_TEAM2: return '0 0 1'; // blue
47         case COLOR_TEAM3: return '1 1 0'; // yellow
48         case COLOR_TEAM4: return '1 0 1'; // pink
49         }
50 }
51
52 string GetTeamName(float color)
53 {
54         switch(color)
55         {
56         default: return "Spectators";
57         case COLOR_TEAM1: return "Red Team";
58         case COLOR_TEAM2: return "Blue Team";
59         case COLOR_TEAM3: return "Yellow Team";
60         case COLOR_TEAM4: return "Pink Team";
61         }
62 }