2 entity ctf_worldflaglist; // CTF flags in the map
3 .entity ctf_worldflagnext;
5 .float next_take_time; // the next time a player can pick up a flag (time + blah)
6 /// I used this, in part, to fix the looping score bug. - avirox
7 //float FLAGSCORE_PICKUP = 1;
8 //float FLAGSCORE_RETURN = 5; // returned by owner team
9 //float FLAGSCORE_RETURNROGUE = 10; // returned by rogue team
10 //float FLAGSCORE_CAPTURE = 5;
12 #define FLAG_CARRY_POS '-15 0 7'
14 void FakeTimeLimit(entity e, float t)
17 WriteByte(MSG_ONE, 3); // svc_updatestat
18 WriteByte(MSG_ONE, 236); // STAT_TIMELIMIT
20 WriteCoord(MSG_ONE, cvar("timelimit"));
22 WriteCoord(MSG_ONE, (t + 1) / 60);
25 float flagcaptimerecord;
26 .float flagpickuptime;
36 self.t_width = 0.1; // frame animation rate
38 self.t_length = 119; // maximum frame
40 setattachment(self, world, "");
41 self.mdl = self.model;
43 self.solid = SOLID_TRIGGER;
44 self.movetype = MOVETYPE_NONE;
45 self.velocity = '0 0 0';
46 self.origin_z = self.origin_z + 6;
47 self.think = FlagThink;
48 self.touch = FlagTouch;
49 self.nextthink = time + 0.1;
51 self.mangle = self.angles;
52 self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP;
53 //self.effects = self.effects | EF_DIMLIGHT;
56 self.movetype = MOVETYPE_TOSS;
59 dprint("Flag fell out of level at ", vtos(self.origin), "\n");
64 self.oldorigin = self.origin;
67 void LogCTF(string mode, float flagteam, entity actor)
70 if(!cvar("sv_eventlog"))
72 s = strcat(":ctf:", mode);
73 s = strcat(s, ":", ftos(flagteam));
75 s = strcat(s, ":", ftos(actor.playerid));
79 void RegenFlag(entity e)
81 setattachment(e, world, "");
82 e.damageforcescale = 0;
83 e.movetype = MOVETYPE_NONE;
85 e.movetype = MOVETYPE_TOSS;
86 e.solid = SOLID_TRIGGER;
87 // TODO: play a sound here
88 setorigin(e, e.oldorigin);
92 e.flags = FL_ITEM; // clear FL_ONGROUND and any other junk
95 void ReturnFlag(entity e)
98 if (e.owner.flagcarried == e)
100 WaypointSprite_DetachCarrier(e.owner);
101 e.owner.flagcarried = world;
104 FakeTimeLimit(e.owner, -1);
110 void DropFlag(entity e, entity penalty_receiver, entity attacker)
122 dprint("FLAG: drop - no owner?!?!\n");
126 if (p.flagcarried != e)
128 dprint("FLAG: drop - owner is not carrying this flag??\n");
131 bprint(p.netname, "^7 lost the ", e.netname, "\n");
134 UpdateFrags(penalty_receiver, -cvar("g_ctf_flagpenalty_suicidedrop"));
136 UpdateFrags(p, -cvar("g_ctf_flagpenalty_drop"));
137 PlayerScore_Add(p, SP_CTF_DROPS, +1);
138 e.playerid = attacker.playerid;
140 WaypointSprite_Ping(p.waypointsprite_attachedforcarrier);
141 WaypointSprite_DetachCarrier(p);
142 LogCTF("dropped", p.team, p);
144 setattachment(e, world, "");
145 e.damageforcescale = cvar("g_balance_ctf_damageforcescale");
147 if (p.flagcarried == e)
148 p.flagcarried = world;
151 e.flags = FL_ITEM; // clear FL_ONGROUND and any other junk
152 e.solid = SOLID_TRIGGER;
153 e.movetype = MOVETYPE_TOSS;
154 // setsize(e, '-16 -16 0', '16 16 74');
155 setorigin(e, p.origin - '0 0 24' + '0 0 37');
156 e.cnt = FLAG_DROPPED;
157 e.velocity = '0 0 300';
158 e.pain_finished = time + cvar("g_ctf_flag_returntime");//30;
160 trace_startsolid = FALSE;
161 tracebox(e.origin, e.mins, e.maxs, e.origin, TRUE, e);
163 dprint("FLAG FALLTHROUGH will happen SOON\n");
168 if(self.delay > time)
170 self.delay = time + self.t_width;
171 if(self.nextthink > self.delay)
172 self.nextthink = self.delay;
174 self.frame = self.frame + 1;
175 if(self.frame > self.t_length)
183 self.nextthink = time + 0.1;
187 if(self.speedrunning)
188 if(self.cnt == FLAG_CARRY)
191 if(flagcaptimerecord)
192 if(time >= self.flagpickuptime + flagcaptimerecord)
194 bprint("The ", self.netname, " became impatient after ", ftos_decimals(flagcaptimerecord, 2), " seconds and returned itself\n");
196 self.owner.impulse = 77; // returning!
206 if (self.cnt == FLAG_BASE)
209 if (self.cnt == FLAG_DROPPED)
211 // flag fallthrough? FIXME remove this if bug is really fixed now
212 if(self.origin_z < -131072)
214 dprint("FLAG FALLTHROUGH just happened\n");
215 self.pain_finished = 0;
217 setattachment(self, world, "");
218 if (time > self.pain_finished)
220 bprint("The ", self.netname, " has returned to base\n");
221 sound (self, CHAN_TRIGGER, self.noise3, VOL_BASE, ATTN_NONE);
222 LogCTF("returned", self.team, world);
229 if (e.classname != "player" || (e.deadflag) || (e.flagcarried != self))
231 dprint("CANNOT HAPPEN - player dead and STILL had a flag!\n");
232 DropFlag(self, world, world);
243 local string s, s0, h0, h1;
244 if (other.classname != "player")
246 if (other.health < 1) // ignore dead players
249 if (self.cnt == FLAG_CARRY)
252 if (self.cnt == FLAG_BASE)
253 if (other.team == self.team)
254 if (other.flagcarried) // he's got a flag
255 if (other.flagcarried.team != self.team) // capture
257 if (other.flagcarried == world)
261 t = time - other.flagcarried.flagpickuptime;
262 s = ftos_decimals(t, 2);
263 s0 = ftos_decimals(flagcaptimerecord, 2);
264 h0 = db_get(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"));
269 h0 = strcat(h0, "^7's"); // h0: display text for previous netname
270 if (flagcaptimerecord == 0)
272 bprint(other.netname, "^7 captured the ", other.flagcarried.netname, " in ", s, " seconds\n");
273 flagcaptimerecord = t;
274 db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time"), ftos(t));
275 db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"), h1);
276 GameLogEcho(strcat(":recordset:", ftos(other.playerid), ":", ftos(t)));
278 else if (t < flagcaptimerecord)
280 bprint(other.netname, "^7 captured the ", other.flagcarried.netname, " in ", s, ", breaking ", strcat(h0, " previous record of ", s0, " seconds\n"));
281 flagcaptimerecord = t;
282 db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time"), ftos(t));
283 db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"), h1);
284 GameLogEcho(strcat(":recordset:", ftos(other.playerid), ":", ftos(t)));
288 bprint(other.netname, "^7 captured the ", other.flagcarried.netname, " in ", s, ", failing to break ", strcat(h0, " record of ", s0, " seconds\n"));
291 PlayerTeamScore_Add(other, SP_CTF_CAPS, ST_CTF_CAPS, 1);
292 LogCTF("capture", other.flagcarried.team, other);
293 // give credit to the individual player
294 UpdateFrags(other, cvar("g_ctf_flagscore_capture"));
296 sound (other, CHAN_AUTO, self.noise2, VOL_BASE, ATTN_NONE);
297 WaypointSprite_DetachCarrier(other);
298 if(self.speedrunning)
299 FakeTimeLimit(other, -1);
300 RegenFlag (other.flagcarried);
301 other.flagcarried = world;
302 other.next_take_time = time + 1;
304 if (self.cnt == FLAG_BASE)
305 if (other.team == COLOR_TEAM1 || other.team == COLOR_TEAM2) // only red and blue team can steal flags
306 if (other.team != self.team)
307 if (!other.flagcarried)
309 if (other.next_take_time > time)
312 self.flagpickuptime = time; // used for timing runs
313 self.speedrunning = other.speedrunning; // if speedrunning, flag will self-return and teleport the owner back after the record
314 if(other.speedrunning)
315 if(flagcaptimerecord)
316 FakeTimeLimit(other, time + flagcaptimerecord);
317 self.solid = SOLID_NOT;
318 setorigin(self, self.origin); // relink
320 other.flagcarried = self;
321 self.cnt = FLAG_CARRY;
322 self.angles = '0 0 0';
323 bprint(other.netname, "^7 got the ", self.netname, "\n");
324 UpdateFrags(other, cvar("g_ctf_flagscore_pickup_base"));
325 PlayerScore_Add(other, SP_CTF_PICKUPS, 1);
326 LogCTF("steal", self.team, other);
327 sound (other, CHAN_AUTO, self.noise, VOL_BASE, ATTN_NONE);
329 FOR_EACH_PLAYER(player)
330 if(player.team == self.team)
331 centerprint(player, "The enemy got your flag! Retrieve it!");
333 self.movetype = MOVETYPE_NONE;
334 setorigin(self, FLAG_CARRY_POS);
335 setattachment(self, other, "");
336 WaypointSprite_AttachCarrier("flagcarrier", other);
337 WaypointSprite_UpdateTeamRadar(other.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, '1 1 0');
338 WaypointSprite_Ping(self.sprite);
343 if (self.cnt == FLAG_DROPPED)
345 self.flags = FL_ITEM; // clear FL_ONGROUND and any other junk
346 if (other.team == self.team || (other.team != COLOR_TEAM1 && other.team != COLOR_TEAM2))
349 bprint(other.netname, "^7 returned the ", self.netname, "\n");
351 // punish the player who last had it
352 FOR_EACH_PLAYER(player)
353 if(player.playerid == self.playerid)
354 PlayerScore_Add(player, SP_SCORE, -cvar("g_ctf_flagpenalty_returned"));
356 // punish the team who was last carrying it
357 if(self.team == COLOR_TEAM1)
358 TeamScore_AddToTeam(COLOR_TEAM2, ST_SCORE, -cvar("g_ctf_flagpenalty_returned"));
360 TeamScore_AddToTeam(COLOR_TEAM1, ST_SCORE, -cvar("g_ctf_flagpenalty_returned"));
362 // reward the player who returned it
363 if(other.playerid == self.playerid) // is this the guy who killed the FC last?
365 if (other.team == COLOR_TEAM1 || other.team == COLOR_TEAM2)
366 UpdateFrags(other, cvar("g_ctf_flagscore_return_by_killer"));
368 UpdateFrags(other, cvar("g_ctf_flagscore_return_rogue_by_killer"));
372 if (other.team == COLOR_TEAM1 || other.team == COLOR_TEAM2)
373 UpdateFrags(other, cvar("g_ctf_flagscore_return"));
375 UpdateFrags(other, cvar("g_ctf_flagscore_return_rogue"));
377 PlayerScore_Add(other, SP_CTF_RETURNS, 1);
378 LogCTF("return", self.team, other);
379 sound (other, CHAN_AUTO, self.noise1, VOL_BASE, ATTN_NONE);
382 else if (!other.flagcarried)
385 self.solid = SOLID_NOT;
386 setorigin(self, self.origin); // relink
388 other.flagcarried = self;
389 self.cnt = FLAG_CARRY;
390 bprint(other.netname, "^7 picked up the ", self.netname, "\n");
393 f = bound(0, (self.pain_finished - time) / cvar("g_ctf_flag_returntime"), 1);
394 //print("factor is ", ftos(f), "\n");
395 f = cvar("g_ctf_flagscore_pickup_dropped_late") * (1-f)
396 + cvar("g_ctf_flagscore_pickup_dropped_early") * f;
398 //print("score is ", ftos(f), "\n");
400 UpdateFrags(other, f);
401 PlayerScore_Add(other, SP_CTF_PICKUPS, 1);
402 LogCTF("pickup", self.team, other);
403 sound (other, CHAN_AUTO, self.noise, VOL_BASE, ATTN_NONE);
405 FOR_EACH_PLAYER(player)
406 if(player.team == self.team)
407 centerprint(player, "The enemy got your flag! Retrieve it!");
409 self.movetype = MOVETYPE_NONE; // flag must have MOVETYPE_NONE here, otherwise it will drop through the floor...
410 setorigin(self, FLAG_CARRY_POS);
411 setattachment(self, other, "");
412 self.damageforcescale = 0;
413 WaypointSprite_AttachCarrier("flagcarrier", other);
414 WaypointSprite_UpdateTeamRadar(other.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, '1 1 0');
419 /*QUAKED spawnfunc_info_player_team1 (1 0 0) (-16 -16 -24) (16 16 24)
420 CTF Starting point for a player
425 viewing angle when spawning
427 void spawnfunc_info_player_team1()
429 self.team = COLOR_TEAM1; // red
430 spawnfunc_info_player_deathmatch();
432 //self.team = 4;self.classname = "info_player_start";spawnfunc_info_player_start();};
434 /*QUAKED spawnfunc_info_player_team2 (1 0 0) (-16 -16 -24) (16 16 24)
435 CTF Starting point for a player in
440 viewing angle when spawning
442 void spawnfunc_info_player_team2()
444 self.team = COLOR_TEAM2; // blue
445 spawnfunc_info_player_deathmatch();
447 //self.team = 13;self.classname = "info_player_start";spawnfunc_info_player_start();};
449 /*QUAKED spawnfunc_info_player_team3 (1 0 0) (-16 -16 -24) (16 16 24)
450 CTF Starting point for a player in
451 team three (Magenta).
455 viewing angle when spawning
457 void spawnfunc_info_player_team3()
459 self.team = COLOR_TEAM3; // purple
460 spawnfunc_info_player_deathmatch();
464 /*QUAKED spawnfunc_info_player_team4 (1 0 0) (-16 -16 -24) (16 16 24)
465 CTF Starting point for a player in
470 viewing angle when spawning
472 void spawnfunc_info_player_team4()
474 self.team = COLOR_TEAM4; // yellow
475 spawnfunc_info_player_deathmatch();
481 /*QUAKED spawnfunc_item_flag_team1 (0 0.5 0.8) (-48 -48 -37) (48 48 37)
482 CTF flag for team one (Red).
483 Multiple are allowed.
487 Angle the flag will point
490 model to use, note this needs red and blue as skins 0 and 1
491 (default models/ctf/flag.md3)
493 sound played when flag is picked up
494 (default ctf/take.wav)
496 sound played when flag is returned by a teammate
497 (default ctf/return.wav)
499 sound played when flag is captured
500 (default ctf/redcapture.wav)
502 sound played when flag is lost in the field and respawns itself
503 (default ctf/respawn.wav)
506 void spawnfunc_item_flag_team1()
514 //if(!cvar("teamplay"))
515 // cvar_set("teamplay", "3");
517 // link flag into ctf_worldflaglist
518 self.ctf_worldflagnext = ctf_worldflaglist;
519 ctf_worldflaglist = self;
521 self.classname = "item_flag_team";
522 self.team = COLOR_TEAM1; // color 4 team (red)
523 self.items = IT_KEY2; // gold key (redish enough)
524 self.netname = "^1RED^7 flag";
525 self.target = "###item###";
527 if(self.spawnflags & 1)
530 self.model = "models/ctf/flag_red.md3";
532 self.noise = "ctf/take.wav";
534 self.noise1 = "ctf/return.wav";
536 self.noise2 = "ctf/redcapture.wav"; // blue team scores by capturing the red flag
538 self.noise3 = "ctf/respawn.wav";
539 precache_model (self.model);
540 setmodel (self, self.model); // precision set below
541 precache_sound (self.noise);
542 precache_sound (self.noise1);
543 precache_sound (self.noise2);
544 precache_sound (self.noise3);
545 //setsize(self, '-16 -16 -37', '16 16 37');
546 setsize(self, PL_MIN, PL_MAX);
547 setorigin(self, self.origin + '0 0 37');
548 self.nextthink = time + 0.2; // start after doors etc
549 self.think = place_flag;
553 //if(!self.glow_size)
554 // self.glow_size = 50;
556 self.effects = self.effects | EF_LOWPRECISION;
557 if(cvar("g_ctf_fullbrightflags"))
558 self.effects |= EF_FULLBRIGHT;
562 waypoint_spawnforitem(self);
564 WaypointSprite_SpawnFixed("redbase", self.origin + '0 0 37', self, sprite);
565 WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_FLAG, '1 0 0');
568 /*QUAKED spawnfunc_item_flag_team2 (0 0.5 0.8) (-48 -48 -24) (48 48 64)
569 CTF flag for team two (Blue).
570 Multiple are allowed.
574 Angle the flag will point
577 model to use, note this needs red and blue as skins 0 and 1
578 (default models/ctf/flag.md3)
580 sound played when flag is picked up
581 (default ctf/take.wav)
583 sound played when flag is returned by a teammate
584 (default ctf/return.wav)
586 sound played when flag is captured
587 (default ctf/bluecapture.wav)
589 sound played when flag is lost in the field and respawns itself
590 (default ctf/respawn.wav)
593 void spawnfunc_item_flag_team2()
600 //if(!cvar("teamplay"))
601 // cvar_set("teamplay", "3");
603 // link flag into ctf_worldflaglist
604 self.ctf_worldflagnext = ctf_worldflaglist;
605 ctf_worldflaglist = self;
607 self.classname = "item_flag_team";
608 self.team = COLOR_TEAM2; // color 13 team (blue)
609 self.items = IT_KEY1; // silver key (bluish enough)
610 self.netname = "^4BLUE^7 flag";
611 self.target = "###item###";
613 if(self.spawnflags & 1)
616 self.model = "models/ctf/flag_blue.md3";
618 self.noise = "ctf/take.wav";
620 self.noise1 = "ctf/return.wav";
622 self.noise2 = "ctf/bluecapture.wav"; // red team scores by capturing the blue flag
624 self.noise3 = "ctf/respawn.wav";
625 precache_model (self.model);
626 setmodel (self, self.model); // precision set below
627 precache_sound (self.noise);
628 precache_sound (self.noise1);
629 precache_sound (self.noise2);
630 precache_sound (self.noise3);
631 //setsize(self, '-16 -16 -37', '16 16 37');
632 setsize(self, PL_MIN, PL_MAX);
633 setorigin(self, self.origin + '0 0 37');
634 self.nextthink = time + 0.2; // start after doors etc
635 self.think = place_flag;
639 //if(!self.glow_size)
640 // self.glow_size = 50;
642 self.effects = self.effects | EF_LOWPRECISION;
643 if(cvar("g_ctf_fullbrightflags"))
644 self.effects |= EF_FULLBRIGHT;
648 waypoint_spawnforitem(self);
650 WaypointSprite_SpawnFixed("bluebase", self.origin + '0 0 37', self, sprite);
651 WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_FLAG, '0 0 1');
655 /*QUAKED spawnfunc_ctf_team (0 .5 .8) (-16 -16 -24) (16 16 32)
656 Team declaration for CTF gameplay, this allows you to decide what team
657 names and control point models are used in your map.
659 Note: If you use spawnfunc_ctf_team entities you must define at least 2! However, unlike
660 domination, you don't need to make a blank one too.
664 Name of the team (for example Red, Blue, Green, Yellow, Life, Death, Offense, Defense, etc)
666 Scoreboard color of the team (for example 4 is red and 13 is blue)
670 void spawnfunc_ctf_team()
677 self.classname = "ctf_team";
678 self.team = self.cnt + 1;
681 // code from here on is just to support maps that don't have control point and team entities
682 void ctf_spawnteam (string teamname, float teamcolor)
684 local entity oldself;
687 self.classname = "ctf_team";
688 self.netname = teamname;
689 self.cnt = teamcolor;
691 spawnfunc_ctf_team();
696 // spawn some default teams if the map is not set up for ctf
697 void ctf_spawnteams()
701 numteams = 2;//cvar("g_ctf_default_teams");
703 ctf_spawnteam("Red", COLOR_TEAM1 - 1);
704 ctf_spawnteam("Blue", COLOR_TEAM2 - 1);
707 void ctf_delayedinit()
709 // if no teams are found, spawn defaults
710 if (find(world, classname, "ctf_team") == world)
718 InitializeEntity(world, ctf_delayedinit, INITPRIO_GAMETYPE);
719 flagcaptimerecord = stof(db_get(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time")));
722 void ctf_setstatus2(entity flag, float shift)
724 if (flag.cnt == FLAG_CARRY)
725 if (flag.owner == self)
726 self.items |= shift * 3;
728 self.items |= shift * 1;
729 else if (flag.cnt == FLAG_DROPPED)
730 self.items |= shift * 2;
739 self.items = self.items - (self.items & IT_RED_FLAG_TAKEN);
740 self.items = self.items - (self.items & IT_RED_FLAG_LOST);
741 self.items = self.items - (self.items & IT_BLUE_FLAG_TAKEN);
742 self.items = self.items - (self.items & IT_BLUE_FLAG_LOST);
746 float redflags, blueflags;
751 for (flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext) if(flag.cnt != FLAG_BASE)
753 if(flag.team == COLOR_TEAM1)
755 else if(flag.team == COLOR_TEAM2)
759 // blinking magic: if there is more than one flag, show one of these in a clever way
761 redflags = mod(floor(time * redflags * 0.75), redflags);
763 blueflags = mod(floor(time * blueflags * 0.75), blueflags);
765 for (flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext) if(flag.cnt != FLAG_BASE)
767 if(flag.team == COLOR_TEAM1)
769 if(--redflags == -1) // happens exactly once (redflags is in 0..count-1, and will --'ed count times)
770 ctf_setstatus2(flag, IT_RED_FLAG_TAKEN);
772 else if(flag.team == COLOR_TEAM2)
774 if(--blueflags == -1) // happens exactly once
775 ctf_setstatus2(flag, IT_BLUE_FLAG_TAKEN);
781 entity(float cteam) ctf_team_has_commander =
784 if(cteam != COLOR_TEAM1 || cteam != COLOR_TEAM2)
787 FOR_EACH_REALPLAYER(pl) {
788 if(pl.team == cteam && pl.iscommander) {
795 void(entity e, float st) ctf_setstate =
801 void(float cteam) ctf_new_commander =
806 FOR_EACH_REALPLAYER(pl) {
807 if(pl.team == cteam) {
808 if(pl.iscommander) { // don't reassign if alreay there
811 if(plmax == world || plmax.frags < pl.frags) <<<<<<<<<<<<<<<<< BROKEN in new scoring system
816 bprint(strcat(ColoredTeamName(cteam), " Team has no Commander!\n"));
820 plmax.iscommander = TRUE;
821 ctf_setstate(plmax, 3);
822 sprint(plmax, "^3You're the commander now!\n");
823 centerprint(plmax, "^3You're the commander now!\n");
826 void() ctf_clientconnect =
828 self.iscommander = FALSE;
830 if(!self.team || self.classname != "player") {
831 ctf_setstate(self, -1);
833 ctf_setstate(self, 0);
835 self.team_saved = self.team;
837 if(self.team != 0 && self.classname == "player" && !ctf_team_has_commander(self.team)) {
838 ctf_new_commander(self.team);
842 void() ctf_playerchanged =
844 if(!self.team || self.classname != "player") {
845 ctf_setstate(self, -1);
846 } else if(self.ctf_state < 0 && self.classname == "player") {
847 ctf_setstate(self, 0);
850 if(self.iscommander &&
851 (self.classname != "player" || self.team != self.team_saved)
854 self.iscommander = FALSE;
855 if(self.classname == "player")
856 ctf_setstate(self, 0);
858 ctf_setstate(self, -1);
859 ctf_new_commander(self.team_saved);
862 self.team_saved = self.team;
864 ctf_new_commander(self.team);
867 void() ctf_clientdisconnect =
871 ctf_new_commander(self.team);
875 entity GetPlayer(string);
876 float() ctf_clientcommand =
879 if(argv(0) == "order") {
881 sprint(self, "This command is not supported in this gamemode.\n");
884 if(!self.iscommander) {
885 sprint(self, "^1You are not the commander!\n");
889 sprint(self, "Usage: order #player status - (playernumber as in status)\n");
892 e = GetPlayer(argv(1));
894 sprint(self, "Invalid player.\nUsage: order #player status - (playernumber as in status)\n");
897 if(e.team != self.team) {
898 sprint(self, "^3You can only give orders to your own team!\n");
901 if(argv(2) == "attack") {
902 sprint(self, strcat("Ordering ", e.netname, " to attack!\n"));
903 sprint(e, "^1Attack!\n");
904 centerprint(e, "^7You've been ordered to^9\n^1Attack!\n");
906 } else if(argv(2) == "defend") {
907 sprint(self, strcat("Ordering ", e.netname, " to defend!\n"));
908 sprint(e, "^Defend!\n");
909 centerprint(e, "^7You've been ordered to^9\n^2Defend!\n");
912 sprint(self, "^7Invalid command, use ^3attack^7, or ^3defend^7.\n");