1 float COLOR_TEAM1 = 5; // red
2 float COLOR_TEAM2 = 14; // blue
3 float COLOR_TEAM3 = 10; // pink
4 float COLOR_TEAM4 = 13; // yellow
7 float GAME_DEATHMATCH = 1;
8 float GAME_TEAM_DEATHMATCH = 2;
9 float GAME_DOMINATION = 3;
11 float GAME_RUNEMATCH = 5;
15 // client counts for each team
17 // # of bots on those teams
18 float cb1, cb2, cb3, cb4;
20 float g_domination, g_ctf, g_tdm;
22 float audit_teams_time;
25 string TeamName(float t)
27 // fixme: Search for team entities and get their .netname's!
36 return "Neutral Team";
38 string ColoredTeamName(float t)
40 // fixme: Search for team entities and get their .netname's!
42 return "^1Red Team^7";
44 return "^4Blue Team^7";
46 return "^6Pink Team^7";
48 return "^3Yellow Team^7";
49 return "Neutral Team";
51 string TeamNoName(float t)
53 // fixme: Search for team entities and get their .netname's!
62 return "Neutral Team";
67 void runematch_init();
70 void(entity pl) LogTeamchange =
73 if(!cvar("sv_eventlog"))
77 str = strcat(":team:", ftos(pl.playerid), ":");
78 str = strcat(str, ftos(pl.team));
79 GameLogEcho(str, FALSE);
84 cvar_set("g_tdm", "0");
85 cvar_set("g_domination", "0");
86 cvar_set("g_ctf", "0");
87 cvar_set("g_runematch", "0");
88 cvar_set("g_lms", "0");
89 cvar_set("teamplay", "0");
92 cvar_set("exit_cfg", "");
95 void ActivateTeamplay()
97 float teamplay_default;
98 teamplay_default = cvar("teamplay_default");
101 cvar_set("teamplay", ftos(teamplay_default));
103 cvar_set("teamplay", "3");
106 string gamemode_name;
109 void InitGameplayMode()
111 float fraglimit_override, timelimit_override;
115 game = cvar ("gamecfg"); // load game options
117 // game cvars get reset before map changes
118 // then map's cfg sets them as desired
120 // FIXME: also set a message or game mode name to print to players when the join
122 // set both here, gamemode can override it later
123 timelimit_override = cvar("timelimit_override");
124 fraglimit_override = cvar("fraglimit_override");
126 if(game == GAME_DOMINATION || cvar("g_domination"))
128 game = GAME_DOMINATION;
129 cvar_set("g_domination", "1");
133 fraglimit_override = cvar("g_domination_point_limit");
135 gamemode_name = "Domination";
138 else if(game == GAME_CTF || cvar("g_ctf"))
141 cvar_set("g_ctf", "1");
145 fraglimit_override = cvar("g_ctf_capture_limit");
147 gamemode_name = "Capture the Flag";
150 else if((game == GAME_RUNEMATCH || cvar("g_runematch")) && !cvar("g_minstagib"))
152 game = GAME_RUNEMATCH;
153 cvar_set("g_runematch", "1");
155 if(cvar("deathmatch_force_teamplay"))
158 fraglimit_override = cvar("g_runematch_point_limit");
160 gamemode_name = "Rune Match";
166 else if(game == GAME_DEATHMATCH || game == GAME_TEAM_DEATHMATCH || cvar("g_tdm"))
168 if(!cvar("deathmatch"))
169 cvar_set("deathmatch", "1");
172 if(game == GAME_TEAM_DEATHMATCH || cvar("g_tdm") || cvar("deathmatch_force_teamplay"))
174 game = GAME_TEAM_DEATHMATCH;
175 gamemode_name = "Team Deathmatch";
178 cvar_set("g_tdm", "1");
182 game = GAME_DEATHMATCH;
183 gamemode_name = "Deathmatch";
187 fraglimit_override = cvar("fraglimit_override");
189 else if(game == GAME_LMS || cvar("g_lms"))
192 cvar_set("g_lms", "1");
193 fraglimit_override = cvar("g_lms_lives_override");
194 if(fraglimit_override == 0)
195 fraglimit_override = -1;
196 gamemode_name = "Last Man Standing";
198 cvar_set("teamplay", "0");
199 lms_lowest_lives = 999;
203 // we can only assume...
204 gamemode_name = "Deathmatch";
207 /* else if(game == GAME_TEAM_DEATHMATCH)
209 if(!cvar("deathmatch"))
210 cvar_set("deathmatch", "1");
212 //if(!cvar("teamplay"))
213 // cvar_set("teamplay", "3");
216 fraglimit_override = cvar("fraglimit_override");
219 // enforce the server's universal frag/time limits
220 if(fraglimit_override >= 0)
221 cvar_set("fraglimit", ftos(fraglimit_override));
222 if(timelimit_override >= 0)
223 cvar_set("timelimit", ftos(timelimit_override));
225 if (game == GAME_DOMINATION)//cvar("g_domination"))
227 else if (game == GAME_CTF)//cvar("g_ctf"))
229 else if (game == GAME_RUNEMATCH)//cvar("g_runematch"))
231 else if (game == GAME_TEAM_DEATHMATCH)//cvar("g_runematch"))
234 // those mutators rule each other out
235 if(cvar("g_minstagib"))
237 cvar_set("g_instagib", "0");
238 cvar_set("g_rocketarena", "0");
240 if(cvar("g_instagib"))
242 cvar_set("g_minstagib", "0");
243 cvar_set("g_rocketarena", "0");
245 if(cvar("g_rocketarena"))
247 cvar_set("g_instagib", "0");
248 cvar_set("g_minstagib", "0");
251 registercvar("_motd", "");
252 registercvar("_mutatormsg", "");
253 cvar_set("_motd", linewrap(cvar_string("sv_motd"), 50));
254 cvar_set("_mutatormsg", linewrap(cvar_string("g_mutatormsg"), 50));
257 string GetClientVersionMessage(float v) {
258 local string versionmsg;
260 versionmsg = "^1client is too old to get versioninfo.\n\n\n### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###\n\n\nUPDATE!!! (http://www.nexuiz.com)^8";
261 // either that or someone wants to be funny
262 } else if (v != cvar("gameversion")) {
263 if(v < cvar("gameversion")) {
264 versionmsg = "^3Your client version is outdated.\n\n\n### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###\n\n\nPlease update!!!^8";
266 versionmsg = "^3This server is using an outdated Nexuiz version.\n\n\n ### THIS SERVER IS INCOMPATIBLE AND THUS YOU CANNOT JOIN ###.^8";
269 versionmsg = "^2client version and server version are compatible.^8";
271 return strzone(versionmsg);
276 void PrintWelcomeMessage(entity pl)
278 string s, mutator, modifications, newlines;
280 /*if(self.welcomemessage_time < time)
282 if(self.welcomemessage_time2 > time)
284 self.welcomemessage_time2 = time + 0.8; */
286 newlines = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
288 if(self.classname == "observer")
290 if(cvar("g_lms") && self.frags <= 0 && self.frags > -666)
291 return centerprint(self, strcat(newlines, "^1You have no more lives left\nwait for next round\n\n\n^7press attack to spectate other players"));
292 else if(cvar("g_lms") && self.frags == -666)
293 return centerprint(self, strcat(newlines, "^1Match has already begun\nwait for next round\n\n\n^7press attack to spectate other players"));
295 else if(self.classname == "spectator")
297 if (cvar("g_lms") && self.frags < 1)
298 return centerprint(self, strcat(newlines, "spectating ", self.enemy.netname, "\n\n\n^7press attack for next player\npress attack2 for free fly mode"));
300 return centerprint(self, strcat(newlines, "spectating ", self.enemy.netname, "\n\n\n^7press jump to play\n^7press attack for next player\npress attack2 for free fly mode"));
304 if(self.welcomemessage_time2 > time) return;
305 self.welcomemessage_time2 = time + 1.0;
307 if(cvar("g_minstagib"))
308 mutator = "^2Minstagib ^1";
309 else if(cvar("g_instagib"))
310 mutator = "^2Instagib ^1";
311 else if(cvar("g_rocketarena"))
312 mutator = "^2Rocketarena ^1";
314 if(cvar("g_midair")) {
315 // to protect against unheedingly made changes
317 modifications = strcat(modifications, ", ");
319 modifications = "midair";
321 if(cvar("g_vampire")) {
323 modifications = strcat(modifications, ", ");
325 modifications = strcat(modifications, "vampire");
327 if(cvar("g_laserguided_missile")) {
329 modifications = strcat(modifications, ", ");
331 modifications = strcat(modifications, "laser-guided-missiles");
334 local string versionmessage;
335 versionmessage = GetClientVersionMessage(self.version);
337 s = strcat(s, newlines, "This is Nexuiz ", cvar_string("g_nexuizversion"), "\n", versionmessage);
338 s = strcat(s, "^8\n\nmatch type is ^1", mutator, gamemode_name, "^8\n");
340 if(modifications != "")
341 s = strcat(s, "^8\nactive modifications: ^3", modifications, "^8\n");
343 if((self.classname == "observer" || self.classname == "spectator") && self.version == cvar("gameversion")) {
344 s = strcat(s,"^7\n\n\npress jump to play\npress attack to spectate other players\n\n");
350 if (cvar("g_grappling_hook"))
351 s = strcat(s, "\n\n^8grappling hook is enabled, press 'e' to use it\n");
353 if (cvar_string("_mutatormsg") != "") {
354 s = strcat(s, "\n\n^8special gameplay tips: ^7", cvar_string("_mutatormsg"));
357 if (cvar_string("_motd") != "") {
358 s = strcat(s, "\n\n^8MOTD: ^7", cvar_string("_motd"));
370 void SetPlayerColors(entity pl, float _color)
374 stuffcmd(pl, strcat("color ", s, " ", s, "\n") );
376 //pl.clientcolors = pl.clientcolors - (pl.clientcolors & 15) + cl;
377 pl.clientcolors = 16*cl + cl;*/
380 pants = _color & 0x0F;
381 shirt = _color & 0xF0;
385 setcolor(pl, 16*pants + pants);
387 setcolor(pl, shirt + pants);
391 void SetPlayerTeam(entity pl, float t, float s, float noprint)
396 _color = COLOR_TEAM4 - 1;
398 _color = COLOR_TEAM3 - 1;
400 _color = COLOR_TEAM2 - 1;
402 _color = COLOR_TEAM1 - 1;
404 SetPlayerColors(pl,_color);
406 if(!noprint && t != s)
408 //bprint(strcat(pl.netname, " has changed to ", TeamNoName(t), "\n"));
409 bprint(strcat(pl.netname, "^7 has changed from ", TeamNoName(s), " to ", TeamNoName(t), "\n"));
421 // set c1...c4 to show what teams are allowed
422 void CheckAllowedTeams ()
431 c1 = c2 = c3 = c4 = -1;
432 cb1 = cb2 = cb3 = cb4 = 0;
435 teament_name = "dom_team";
437 teament_name = "ctf_team";
439 teament_name = "tdm_team";
442 // cover anything else by treating it like tdm with no teams spawned
443 dm = cvar("g_tdm_teams");
445 error("g_tdm_teams < 2, not enough teams to play team deathmatch\n");
449 c1 = c2 = c3 = c4 = 0;
462 // first find out what teams are allowed
463 head = find(world, classname, teament_name);
466 if(!(g_domination && head.netname == ""))
468 if(head.team == COLOR_TEAM1)
472 if(head.team == COLOR_TEAM2)
476 if(head.team == COLOR_TEAM3)
480 if(head.team == COLOR_TEAM4)
485 head = find(head, classname, teament_name);
489 // c1...c4 should be set to -1 (not allowed) or 0 (allowed).
490 // teams that are allowed will now have their player counts stored in c1...c4
491 void GetTeamCounts(entity ignore)
494 // now count how many players are on each team already
496 // FIXME: also find and memorize the lowest-scoring bot on each team (in case players must be shuffled around)
497 // also remember the lowest-scoring player
499 head = find(world, classname, "player");
502 if(head != ignore)// && head.netname != "")
504 if(head.team == COLOR_TEAM1)
512 if(head.team == COLOR_TEAM2)
520 if(head.team == COLOR_TEAM3)
528 if(head.team == COLOR_TEAM4)
537 head = find(head, classname, "player");
541 // returns # of smallest team (1, 2, 3, 4)
542 // NOTE: Assumes CheckAllowedTeams has already been called!
543 float FindSmallestTeam(entity pl, float ignore_pl)
545 float totalteams, smallestteam, smallestteam_count, balance_type;
548 // find out what teams are available
549 //CheckAllowedTeams();
551 // make sure there are at least 2 teams to join
553 totalteams = totalteams + 1;
555 totalteams = totalteams + 1;
557 totalteams = totalteams + 1;
559 totalteams = totalteams + 1;
564 error("Too few teams available for domination\n");
566 error("Too few teams available for ctf\n");
568 error("Too few teams available for team deathmatch\n");
572 // count how many players are in each team
574 GetTeamCounts(world);
580 // c1...c4 now have counts of each team
581 // figure out which is smallest, giving priority to the team the player is already on as a tie-breaker
584 smallestteam_count = 999;
586 // 2 gives priority to what team you're already on, 1 goes in order
587 // 2 doesn't seem to work though...
590 if(balance_type == 1)
592 if(c1 >= 0 && c1 < smallestteam_count)
595 smallestteam_count = c1;
597 if(c2 >= 0 && c2 < smallestteam_count)
600 smallestteam_count = c2;
602 if(c3 >= 0 && c3 < smallestteam_count)
605 smallestteam_count = c3;
607 if(c4 >= 0 && c4 < smallestteam_count)
610 smallestteam_count = c4;
615 if(c1 >= 0 && (c1 < smallestteam_count ||
616 (c1 == smallestteam_count && self.team == COLOR_TEAM1) ) )
619 smallestteam_count = c1;
621 if(c2 >= 0 && c2 < (c2 < smallestteam_count ||
622 (c2 == smallestteam_count && self.team == COLOR_TEAM2) ) )
625 smallestteam_count = c2;
627 if(c3 >= 0 && c3 < (c3 < smallestteam_count ||
628 (c3 == smallestteam_count && self.team == COLOR_TEAM3) ) )
631 smallestteam_count = c3;
633 if(c4 >= 0 && c4 < (c4 < smallestteam_count ||
634 (c4 == smallestteam_count && self.team == COLOR_TEAM4) ) )
637 smallestteam_count = c4;
644 float JoinBestTeam(entity pl, float only_return_best)
646 float smallest, selectedteam;
648 g_domination = cvar("g_domination");
649 g_ctf = cvar("g_ctf");
651 // don't join a team if we're not playing a team game
652 if(!cvar("teamplay") && !g_domination && !g_ctf)
655 // find out what teams are available
659 if(cvar("g_domination"))
661 if(cvar("g_domination_default_teams") < 3)
663 if(cvar("g_domination_default_teams") < 4)
667 // if we don't care what team he ends up on, put him on whatever team he entered as.
668 // if he's not on a valid team, then let other code put him on the smallest team
669 if(!cvar("g_balance_teams") && !cvar("g_balance_teams_force"))
671 if( c1 >= 0 && pl.team == COLOR_TEAM1)
672 selectedteam = pl.team;
673 else if(c2 >= 0 && pl.team == COLOR_TEAM2)
674 selectedteam = pl.team;
675 else if(c3 >= 0 && pl.team == COLOR_TEAM3)
676 selectedteam = pl.team;
677 else if(c4 >= 0 && pl.team == COLOR_TEAM4)
678 selectedteam = pl.team;
683 if(!only_return_best)
685 SetPlayerColors(pl, selectedteam - 1);
690 // otherwise end up on the smallest team (handled below)
693 smallest = FindSmallestTeam(pl, TRUE);
696 if(!only_return_best)
700 SetPlayerColors(pl, COLOR_TEAM1 - 1);
702 else if(smallest == 2)
704 SetPlayerColors(pl, COLOR_TEAM2 - 1);
706 else if(smallest == 3)
708 SetPlayerColors(pl, COLOR_TEAM3 - 1);
710 else if(smallest == 4)
712 SetPlayerColors(pl, COLOR_TEAM4 - 1);
716 error("smallest team: invalid team\n");
719 if(pl.deadflag == DEAD_NO)
720 Damage(pl, pl, pl, 100000, DEATH_TEAMCHANGE, pl.origin, '0 0 0');
727 void SV_ChangeTeam(float _color)
729 float scolor, dcolor, steam, dteam, dbotcount, scount, dcount;
731 // in normal deathmatch we can just apply the color and we're done
732 if(!cvar("teamplay")) {
733 SetPlayerColors(self, _color);
737 scolor = self.clientcolors & 0x0F;
738 dcolor = _color & 0x0F;
740 if(scolor == COLOR_TEAM1 - 1)
742 else if(scolor == COLOR_TEAM2 - 1)
744 else if(scolor == COLOR_TEAM3 - 1)
746 else if(scolor == COLOR_TEAM4 - 1)
748 if(dcolor == COLOR_TEAM1 - 1)
750 else if(dcolor == COLOR_TEAM2 - 1)
752 else if(dcolor == COLOR_TEAM3 - 1)
754 else if(dcolor == COLOR_TEAM4 - 1)
757 // remap invalid teams in dom & ctf
758 if(cvar("g_ctf") && dteam == 3)
760 else if(cvar("g_ctf") && dteam == 4)
762 else if((cvar("g_domination") && cvar("g_domination_default_teams") < 3) || (cvar("g_tdm") && cvar("g_tdm_teams") < 3))
769 else if((cvar("g_domination") && cvar("g_domination_default_teams") < 4) || (cvar("g_tdm") && cvar("g_tdm_teams") < 4))
775 // not changing teams
778 //bprint("same team change\n");
779 SetPlayerTeam(self, dteam, steam, TRUE);
785 if(cvar("g_changeteam_banned"))
787 sprint(self, "Team changes not allowed\n");
788 return; // changing teams is not allowed
791 if(cvar("g_balance_teams_prevent_imbalance"))
793 // only allow changing to a smaller or equal size team
795 // find out what teams are available
797 // count how many players on each team
798 GetTeamCounts(world);
801 if(dteam == 1 && c1 >= 0)//dcolor == COLOR_TEAM1 - 1)
806 else if(dteam == 2 && c2 >= 0)//dcolor == COLOR_TEAM2 - 1)
811 else if(dteam == 3 && c3 >= 0)//dcolor == COLOR_TEAM3 - 1)
816 else if(dteam == 4 && c4 >= 0)//dcolor == COLOR_TEAM4 - 1)
823 sprint(self, "Cannot change to an invalid team\n");
829 if(steam == 1)//scolor == COLOR_TEAM1 - 1)
831 else if(steam == 2)//scolor == COLOR_TEAM2 - 1)
833 else if(steam == 3)//scolor == COLOR_TEAM3 - 1)
835 else if(steam == 4)//scolor == COLOR_TEAM4 - 1)
838 if(scount) // started at a valid, nonempty team
840 // check if we're trying to change to a larger team that doens't have bots to swap with
841 if(dcount >= scount && dbotcount <= 0)
843 sprint(self, "Cannot change to a larger team\n");
844 return; // can't change to a larger team
850 // bprint(strcat("allow change teams from ", ftos(steam), " to ", ftos(dteam), "\n"));
852 SetPlayerTeam(self, dteam, steam, FALSE);
853 if(cvar("teamplay") && self.classname == "player" && steam != dteam)
855 // kill player when changing teams
856 if(self.deadflag == DEAD_NO)
857 Damage(self, self, self, 100000, DEATH_TEAMCHANGE, self.origin, '0 0 0');
858 // reduce frags during a team change
859 self.frags = floor(self.frags * (cvar("g_changeteam_fragtransfer") / 100));
864 void ShufflePlayerOutOfTeam (float source_team)
866 float smallestteam, smallestteam_count, steam;
867 float lowest_bot_score, lowest_player_score;
868 entity head, lowest_bot, lowest_player, selected;
872 smallestteam_count = 999;
874 if(c1 >= 0 && c1 < smallestteam_count)
877 smallestteam_count = c1;
879 if(c2 >= 0 && c2 < smallestteam_count)
882 smallestteam_count = c2;
884 if(c3 >= 0 && c3 < smallestteam_count)
887 smallestteam_count = c3;
889 if(c4 >= 0 && c4 < smallestteam_count)
892 smallestteam_count = c4;
897 bprint("warning: no smallest team\n");
903 else if(source_team == 2)
905 else if(source_team == 3)
907 else if(source_team == 4)
911 lowest_bot_score = 9999;
912 lowest_player = world;
913 lowest_player_score = 9999;
915 // find the lowest-scoring player & bot of that team
916 head = find(world, classname, "player");
919 if(head.team == steam)
923 if(head.frags < lowest_bot_score)
926 lowest_bot_score = head.frags;
931 if(head.frags < lowest_player_score)
933 lowest_player = head;
934 lowest_player_score = head.frags;
938 head = find(head, classname, "player");
941 // prefers to move a bot...
942 if(lowest_bot != world)
943 selected = lowest_bot;
944 // but it will move a player if it has to
946 selected = lowest_player;
947 // don't do anything if it couldn't find anyone
950 bprint("warning: couldn't find a player to move from team\n");
954 // smallest team gains a member
955 if(smallestteam == 1)
959 else if(smallestteam == 2)
963 else if(smallestteam == 3)
967 else if(smallestteam == 4)
973 bprint("warning: destination team invalid\n");
976 // source team loses a member
981 else if(source_team == 2)
985 else if(source_team == 3)
989 else if(source_team == 4)
995 bprint("warning: source team invalid\n");
999 // move the player to the new team
1000 SetPlayerTeam(selected, smallestteam, source_team, FALSE);
1002 if(selected.deadflag == DEAD_NO)
1003 Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE, selected.origin, '0 0 0');
1004 m = "You have been moved into a different team to improve team balance\nYou are now on: ";
1005 if (selected.team == 5)
1006 m = strcat(m, "^1Red Team");
1007 else if (selected.team == 14)
1008 m = strcat(m, "^4Blue Team");
1009 else if (selected.team == 10)
1010 m = strcat(m, "^6Pink Team");
1011 else if (selected.team == 13)
1012 m = strcat(m, "^3Yellow Team");
1013 centerprint(selected, m);
1016 // part of g_balance_teams_force
1017 // occasionally perform an audit of the teams to make
1018 // sure they're more or less balanced in player count.
1021 float numplayers, numteams, average;
1022 if(!cvar("g_balance_teams_force"))
1024 if(!cvar("teamplay"))
1027 if(audit_teams_time > time)
1030 audit_teams_time = time + 4 + random();
1032 // bprint("Auditing teams\n");
1034 CheckAllowedTeams();
1035 GetTeamCounts(world);
1038 numteams = numplayers = 0;
1041 numteams = numteams + 1;
1042 numplayers = numplayers + c1;
1046 numteams = numteams + 1;
1047 numplayers = numplayers + c2;
1051 numteams = numteams + 1;
1052 numplayers = numplayers + c3;
1056 numteams = numteams + 1;
1057 numplayers = numplayers + c4;
1061 return; // no players to move around
1063 return; // don't bother shuffling if for some reason there aren't any teams
1065 average = ceil(numplayers / numteams);
1068 return; // that's weird...
1070 if(c1 && c1 > average)
1072 bprint("Rebalancing Teams\n");
1073 //bprint("Shuffle from team 1\n");
1074 ShufflePlayerOutOfTeam(1);
1076 if(c2 && c2 > average)
1078 bprint("Rebalancing Teams\n");
1079 //bprint("Shuffle from team 2\n");
1080 ShufflePlayerOutOfTeam(2);
1082 if(c3 && c3 > average)
1084 bprint("Rebalancing Teams\n");
1085 //bprint("Shuffle from team 3\n");
1086 ShufflePlayerOutOfTeam(3);
1088 if(c4 && c4 > average)
1090 bprint("Rebalancing Teams\n");
1091 //bprint("Shuffle from team 4\n");
1092 ShufflePlayerOutOfTeam(4);
1095 // if teams are still unbalanced, balance them further in the next audit,
1096 // which will happen sooner (keep doing rapid audits until things are in order)
1097 audit_teams_time = time + 0.7 + random()*0.3;
1102 /*void(entity e, float first) UpdateTeamScore =
1107 WriteByte (MSG_ALL, SVC_UPDATENAME);
1108 WriteByte (MSG_ALL, clientno);
1109 WriteString (MSG_ALL, e.netname);
1111 WriteByte (MSG_ALL, SVC_UPDATECOLORS);
1112 WriteByte (MSG_ALL, clientno);
1113 WriteByte (MSG_ALL, e.b_shirt * 16 + who.b_pants);
1116 WriteByte (MSG_ALL, SVC_UPDATEFRAGS);
1117 WriteByte (MSG_ALL, clientno);
1118 WriteShort (MSG_ALL, e.frags + 10000);
1124 // code from here on is just to support maps that don't have team entities
1125 void tdm_spawnteam (string teamname, float teamcolor)
1129 e.classname = "tdm_team";
1130 e.netname = teamname;
1135 // spawn some default teams if the map is not set up for tdm
1136 void() tdm_spawnteams =
1140 numteams = cvar("g_tdm_teams");
1142 tdm_spawnteam("Red", 4);
1143 tdm_spawnteam("Blue", 13);
1146 void() tdm_delayedinit =
1148 self.think = SUB_Remove;
1149 self.nextthink = time;
1150 // if no teams are found, spawn defaults
1151 if (find(world, classname, "tdm_team") == world)
1159 e.think = tdm_delayedinit;
1160 e.nextthink = time + 0.1;