]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/clientcommands.qc
use DP_QC_TOKENIZE_CONSOLE if available
[divverent/nexuiz.git] / data / qcsrc / server / clientcommands.qc
1 entity nagger;
2 float readycount;
3 float Nagger_SendEntity(entity to, float sendflags)
4 {
5         float nags;
6         WriteByte(MSG_ENTITY, ENT_CLIENT_NAGGER);
7
8         nags = 0;
9         if(readycount)
10         {
11                 nags |= 1;
12                 if(to.ready == 0)
13                         nags |= 2;
14         }
15         if(votecalled)
16         {
17                 nags |= 4;
18                 if(to.vote_vote == 0)
19                         nags |= 8;
20         }
21
22         if(sendflags & 128)
23         {
24                 WriteByte(MSG_ENTITY, nags | 128);
25                 if(votecalled)
26                         WriteString(MSG_ENTITY, votecalledvote_display);
27                 else
28                         WriteString(MSG_ENTITY, "");
29         }
30         else
31                 WriteByte(MSG_ENTITY, nags);
32
33         return TRUE;
34 }
35 void Nagger_Init()
36 {
37         nagger = spawn();
38         Net_LinkEntity(nagger);
39         nagger.SendFlags = 128;
40         nagger.SendEntity = Nagger_SendEntity;
41 }
42 void Nagger_VoteChanged()
43 {
44         if(nagger)
45                 nagger.SendFlags = 128;
46 }
47 void Nagger_VoteCountChanged()
48 {
49         if(nagger)
50                 nagger.SendFlags = 1;
51 }
52 void Nagger_ReadyCounted()
53 {
54         if(nagger)
55                 nagger.SendFlags = 1;
56 }
57
58 void ReadyCount();
59 string MapVote_Suggest(string m);
60
61 .float floodcontrol_chat;
62 .float floodcontrol_team;
63 void Say(entity source, float teamsay, string msgin)
64 {
65         string msgstr, colorstr, cmsgstr, namestr;
66         float flood;
67         entity head;
68
69         if(Ban_MaybeEnforceBan(source))
70                 return;
71
72         if(!teamsay)
73                 if(substring(msgin, 0, 1) == " ")
74                         msgin = substring(msgin, 1, strlen(msgin) - 1); // work around DP say bug (say_team does not have this!)
75
76         msgin = formatmessage(msgin);
77
78         if(msgin == "")
79                 return;
80
81         if(source.classname != "player")
82                 colorstr = "^0"; // black for spectators
83         else if(teams_matter)
84                 colorstr = Team_ColorCode(source.team);
85         else
86                 teamsay = FALSE;
87
88         if(intermission_running)
89                 teamsay = FALSE;
90
91         /*
92          * using bprint solves this... me stupid
93         // how can we prevent the message from appearing in a listen server?
94         // for now, just give "say" back and only handle say_team
95         if(!teamsay)
96         {
97                 clientcommand(self, strcat("say ", msgin));
98                 return;
99         }
100         */
101
102         if(cvar("g_chat_teamcolors"))
103                 namestr = playername(source);
104         else
105                 namestr = source.netname;
106         if(teamsay)
107         {
108                 msgstr = strzone(strcat("\{1}\{13}", colorstr, "(^3", namestr, colorstr, ") ^7", msgin, "\n"));
109                 cmsgstr = strcat(colorstr, "(^3", namestr, colorstr, ")\n^7", wordwrap(msgin, 50));
110         }
111         else
112                 msgstr = strzone(strcat("\{1}", namestr, "^7: ", msgin, "\n"));
113
114         // FLOOD CONTROL
115         flood = 0;
116         {
117                 float flood_spl;
118                 float flood_burst;
119                 float flood_lmax;
120                 var .float flood_field;
121                 float lines;
122                 if(teamsay)
123                 {
124                         flood_spl = cvar("g_chat_flood_spl_team");
125                         flood_burst = cvar("g_chat_flood_burst_team");
126                         flood_lmax = cvar("g_chat_flood_lmax_team");
127                         flood_field = floodcontrol_team;
128                 }
129                 else
130                 {
131                         flood_spl = cvar("g_chat_flood_spl");
132                         flood_burst = cvar("g_chat_flood_burst");
133                         flood_lmax = cvar("g_chat_flood_lmax");
134                         flood_field = floodcontrol_chat;
135                 }
136                 flood_burst = max(0, flood_burst - 1);
137                 // to match explanation in default.cfg, a value of 3 must allow three-line bursts and not four!
138                 lines = ceil(strlennocol(msgstr) / 75);
139                 if(flood_lmax && lines > flood_lmax)
140                         flood = 2;
141                 else if(time >= self.flood_field)
142                         self.flood_field = max(time - flood_burst * flood_spl, self.flood_field) + lines * flood_spl;
143                 else
144                         flood = 1;
145         }
146
147         if(flood)
148         {
149                 if(cvar("g_chat_flood_notify_flooder"))
150                 {
151                         if(flood == 1)
152                                 sprint(self, strcat("^3FLOOD CONTROL: ^7wait ^1", ftos(self.flood_field - time), "^3 seconds\n"));
153                         else if(flood == 2)
154                                 sprint(self, "^3FLOOD CONTROL: ^7message too long\n");
155                 }
156                 else
157                         sprint(self, msgstr);
158                 print("NOTE: ", playername(self), "^7 is flooding.\n");
159         }
160         else if(teamsay)
161         {
162                 if(source.classname == "player")
163                 {
164                         FOR_EACH_REALPLAYER(head)
165                         {
166                                 if(head.team == source.team)
167                                 {
168                                         sprint(head, msgstr);
169                                         centerprint(head, cmsgstr);
170                                 }
171                         }
172                 }
173                 else
174                 {
175                         FOR_EACH_REALCLIENT(head) if(head.classname != "player")
176                         {
177                                 sprint(head, msgstr);
178                                 centerprint(head, cmsgstr);
179                         }
180                 }
181         }
182         else
183         {
184                 // TODO invent a cvar name for allowing global chat by spectators during warmup anyway
185                 if(cvar("g_chat_nospectators") && source.classname != "player") {
186                         FOR_EACH_REALCLIENT(head) if(head.classname != "player") {
187                                 sprint(head, msgstr);
188                         }
189                 }
190                 else
191                         bprint(msgstr);
192         }
193
194         strunzone(msgstr);
195 }
196
197 entity GetPlayer(string name)
198 {
199         float num;
200         entity e;
201         string ns;
202
203         if(substring(name, 0, 1) == "#") {
204                 num = stof(substring(name, 1, 999));
205                 if(num >= 1 && num <= maxclients) {
206                         for((e = world); num > 0; --num, (e = nextent(e)))
207                                 ;
208                         //if(clienttype(e) == CLIENTTYPE_REAL)
209                         if(e.classname == "player")
210                                 return e;
211                 }
212         } else {
213                 ns = strdecolorize(name);
214                 FOR_EACH_REALPLAYER(e) {
215                         if(!strcasecmp(strdecolorize(e.netname), ns)) {
216                                 return e;
217                         }
218                 }
219         }
220         return world;
221 }
222
223 //float ctf_clientcommand();
224 float readyrestart_happened;
225 void SV_ParseClientCommand(string s) {
226         local string cmd;
227         local float tokens, f, effectnum;
228         local vector start, end;
229
230         tokens = tokenize_sane(s);
231
232         if(GameCommand_Vote(s, self)) {
233                 return;
234         } else if(GameCommand_MapVote(argv(0))) {
235                 return;
236         } else if(argv(0) == "autoswitch") {
237                 // be backwards compatible with older clients (enabled)
238                 self.autoswitch = ("0" != argv(1));
239                 local string autoswitchmsg;
240                 if (self.autoswitch) {
241                         autoswitchmsg = "on";
242                 } else {
243                         autoswitchmsg = "off";
244                 }
245                 sprint(self, strcat("^1autoswitch turned ", autoswitchmsg, "\n"));
246         } else if(argv(0) == "clientversion") {
247                 if not(self.flags & FL_CLIENT)
248                         return;
249                 if (argv(1) == "$gameversion") {
250                         //versionmsg = "^1client is too old to get versioninfo.\nUPDATE!!! (http://www.nexuiz.com)^8";
251                         // either that or someone wants to be funny
252                         self.version = 1;
253                 } else {
254                         self.version = stof(argv(1));
255                 }
256                 if(self.version != cvar("gameversion"))
257                 {
258                         self.classname = "observer";
259                         self.version_mismatch = 1;
260                         PutClientInServer();
261                 } else if(cvar("g_campaign") || cvar("g_balance_teams") || cvar("g_balance_teams_force")) {
262                         //JoinBestTeam(self, FALSE, TRUE);
263                 } else if(cvar("teamplay") && !cvar("sv_spectate")) {
264                         self.classname = "observer";
265                         stuffcmd(self,"menu_showteamselect\n");
266                 }
267         } else if(argv(0) == "reportcvar") { // old system
268                 GetCvars(1);
269         } else if(argv(0) == "sentcvar") { // new system
270                 GetCvars(1);
271         } else if(argv(0) == "spectate") {
272                 if not(self.flags & FL_CLIENT)
273                         return;
274                 if(g_lms || g_arena)
275                         return; // don't allow spectating in lms, unless player runs out of lives
276                 if(self.classname == "player" && cvar("sv_spectate") == 1) {
277                         if(self.flagcarried)
278                                 DropFlag(self.flagcarried, world, world);
279                         kh_Key_DropAll(self, TRUE);
280                         WaypointSprite_PlayerDead();
281                         self.classname = "observer";
282                         if(blockSpectators)
283                                 sprint(self, strcat("^7You have to become a player within the next ", ftos(cvar("g_maxplayers_spectator_blocktime")), " seconds, otherwise you will be kicked, because spectators aren't allowed at this time!\n"));
284                         PutClientInServer();
285                 }
286         } else if(argv(0) == "join") {
287                 if not(self.flags & FL_CLIENT)
288                         return;
289                 if(!g_arena)
290                 if (self.classname != "player" && !lockteams)
291                 {
292                         if(isJoinAllowed()) {
293                                 self.classname = "player";
294                                 PlayerScore_Clear(self);
295                                 bprint ("^4", self.netname, "^4 is playing now\n");
296                                 PutClientInServer();
297                         }
298                         else {
299                                 //player may not join because of g_maxplayers is set
300                                 centerprint_atprio(self, CENTERPRIO_MAPVOTE, PREVENT_JOIN_TEXT);
301                         }
302                 }
303         } else if( argv(0) == "selectteam" ) {
304                 if not(self.flags & FL_CLIENT)
305                         return;
306                 if( !cvar("teamplay") ) {
307                         sprint( self, "selecteam can only be used in teamgames\n");
308                 } else if(cvar("g_campaign")) {
309                         //JoinBestTeam(self, 0);
310                 } else if(lockteams) {
311                         sprint( self, "^7The game has already begun, you must wait until the next map to be able to join a team.\n");
312                 } else if( argv(1) == "red" ) {
313                         DoTeamChange(COLOR_TEAM1);
314                 } else if( argv(1) == "blue" ) {
315                         DoTeamChange(COLOR_TEAM2);
316                 } else if( argv(1) == "yellow" ) {
317                         DoTeamChange(COLOR_TEAM3);
318                 } else if( argv(1) == "pink" ) {
319                         DoTeamChange(COLOR_TEAM4);
320                 } else if( argv(1) == "auto" ) {
321                         DoTeamChange(-1);
322                 } else {
323                         sprint( self, strcat( "selectteam none/red/blue/yellow/pink/auto - \"", argv(1), "\" not recognised\n" ) );
324                 }
325         } else if(argv(0) == "ready") {
326                 if not(self.flags & FL_CLIENT)
327                         return;
328                 if((inWarmupStage && 0 <= g_warmup_limit) // with unlimited warmup players have to be able to restart
329                    || cvar("sv_ready_restart"))
330                 {
331                         if(timeoutStatus) {
332                                 return sprint(self, "^1You cannot reset the game while a timeout is active!\n");
333                         }
334                         
335                         //if(!restartAnnouncer)
336                         {
337                                 if(!readyrestart_happened || cvar("sv_ready_restart_repeatable"))
338                                 {
339                                         self.ready = TRUE;
340                                         bprint(self.netname, "^2 is ready\n");
341                                         ReadyCount();
342                                 } else {
343                                         sprint(self, "^1game has already been restarted\n");
344                                 }
345                         }
346                 }
347         } else if(argv(0) == "maplist") {
348                 sprint(self, maplist_reply);
349         } else if(argv(0) == "lsmaps") {
350                 sprint(self, lsmaps_reply);
351         } else if(argv(0) == "records") {
352                 sprint(self, records_reply);
353         } else if(argv(0) == "voice") {
354                 VoiceMessage(argv(1));
355         } else if(argv(0) == "say") {
356                 if(tokens >= 2)
357                         Say(self, FALSE, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
358                 //clientcommand(self, formatmessage(s));
359         } else if(argv(0) == "say_team") {
360                 if(tokens >= 2)
361                         Say(self, TRUE, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
362                 //clientcommand(self, formatmessage(s));
363         } else if(argv(0) == "info") {
364                 cmd = cvar_string(strcat("sv_info_", argv(1)));
365                 if(cmd == "")
366                         sprint(self, "ERROR: unsupported info command\n");
367                 else
368                         wordwrap_sprint(cmd, 1111);
369         } else if(argv(0) == "suggestmap") {
370                 sprint(self, strcat(MapVote_Suggest(argv(1)), "\n"));
371         } else if(argv(0) == "calltimeout") {
372                 if not(self.flags & FL_CLIENT)
373                         return;
374                 if(cvar("sv_timeout")) {
375                         if(self.classname == "player") {
376                                 if(votecalled)
377                                         sprint(self, "^7Error: you can not call a timeout while a vote is active!\n");
378                                 else
379                                         evaluateTimeoutCall();
380                         }
381                         else
382                                 sprint(self, "^7Error: only players can call a timeout!\n");
383                 }
384         } else if(argv(0) == "resumegame") {
385                 if not(self.flags & FL_CLIENT)
386                         return;
387                 if(cvar("sv_timeout")) {
388                         evaluateResumeGame();
389                 }
390         } else if(argv(0) == "teamstatus") {
391                 Score_NicePrint(self);
392         } else if(argv(0) == "cvar_changes") {
393                 sprint(self, cvar_changes);
394         } else if(argv(0) == "pointparticles") {
395                 if(sv_cheats && tokens == 5)
396                 {
397                         // arguments:
398                         //   effectname
399                         //   origin (0..1, on crosshair line)
400                         //   velocity
401                         //   howmany
402                         effectnum = particleeffectnum(argv(1));
403                         f = stof(argv(2));
404                         start = (1-f) * self.origin + f * self.cursor_trace_endpos;
405                         end = stov(argv(3));
406                         f = stof(argv(4));
407                         pointparticles(effectnum, start, end, f);
408                 }
409                 else
410                         print("Usage: sv_cheats 1; restart; cmd pointparticles effectname position(0..1) velocityvector multiplier\n");
411         } else if(argv(0) == "trailparticles") {
412                 if(sv_cheats && tokens == 3)
413                 {
414                         // arguments:
415                         //   effectname
416                         //   shot origin vector
417                         effectnum = particleeffectnum(argv(1));
418                         W_SetupShot(self, stov(argv(2)), FALSE, FALSE, "");
419                         traceline(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, MOVE_NORMAL, self);
420                         trailparticles(self, effectnum, w_shotorg, trace_endpos);
421                 }
422                 else
423                         print("Usage: sv_cheats 1; restart; cmd trailparticles effectname shotorigin\n");
424         } else {
425                 //if(ctf_clientcommand())
426                 //      return;
427                 cmd = argv(0);
428                 // grep for Cmd_AddCommand_WithClientCommand to find them all
429                 if(cmd != "status")
430                 if(cmd != "max")
431                 if(cmd != "monster")
432                 if(cmd != "scrag")
433                 if(cmd != "wraith")
434                 if(cmd != "gimme")
435                 if(cmd != "god")
436                 if(cmd != "notarget")
437                 if(cmd != "fly")
438                 if(cmd != "noclip")
439                 if(cmd != "give")
440                 //if(cmd != "say") // handled above
441                 //if(cmd != "say_team") // handled above
442                 if(cmd != "tell")
443                 if(cmd != "kill")
444                 if(cmd != "pause")
445                 if(cmd != "ping")
446                 if(cmd != "name")
447                 if(cmd != "color")
448                 if(cmd != "rate")
449                 if(cmd != "pmodel")
450                 if(cmd != "playermodel")
451                 if(cmd != "playerskin")
452                 if(cmd != "prespawn")
453                 if(cmd != "spawn")
454                 if(cmd != "begin")
455                 if(cmd != "pings")
456                 if(cmd != "sv_startdownload")
457                 if(cmd != "download")
458                 {
459                         print("WARNING: Invalid clientcommand by ", self.netname, ": ", s, "\n");
460                         return;
461                 }
462                 clientcommand(self,s);
463         }
464 }
465
466 void ReadyRestartForce()
467 {
468         local entity e;
469
470         bprint("^1Server is restarting...\n");
471
472         VoteReset();
473
474         // clear overtime
475         if(checkrules_overtimeend)
476                 checkrules_overtimeend = 0;
477
478         readyrestart_happened = 1;
479         game_starttime = time + RESTART_COUNTDOWN;
480         restart_mapalreadyrestarted = 0; //reset this var, needed when cvar sv_ready_restart_repeatable is in use
481
482         inWarmupStage = 0; //once the game is restarted the game is in match stage
483
484         //reset the .ready status of all players (also spectators)
485         FOR_EACH_CLIENTSLOT(e)
486                 e.ready = 0;
487         readycount = 0;
488         Nagger_ReadyCounted();
489         FOR_EACH_REALCLIENT(e)
490         {
491                 msg_entity = e;
492                 WriteByte(MSG_ONE, SVC_TEMPENTITY);
493                 WriteByte(MSG_ONE, TE_CSQC_WARMUP);
494                 WriteByte(MSG_ONE, 0);
495         }
496
497         if(cvar("teamplay_lockonrestart") && teams_matter) {
498                 lockteams = 1;
499                 bprint("^1The teams are now locked.\n");
500         }
501         
502         //initiate the restart-countdown-announcer entity
503         restartAnnouncer = spawn();
504         restartAnnouncer.think = restartAnnouncer_Think;
505         restartAnnouncer.nextthink = time;
506         restartAnnouncer.spawnflags = !!cvar("sv_ready_restart_after_countdown");
507         
508         //after a restart every players number of allowed timeouts gets reset, too
509         if(cvar("sv_timeout"))
510         {
511                 FOR_EACH_REALPLAYER(e)
512                         e.allowedTimeouts = cvar("sv_timeout_number");
513         }
514
515         //play the prepareforbattle sound to everyone
516         play2all("announcer/robotic/prepareforbattle.wav");
517
518         //reset map immediately if this cvar is not set
519         if (!cvar("sv_ready_restart_after_countdown"))
520                 reset_map();
521         
522         if(cvar("sv_eventlog"))
523                 GameLogEcho(":restart");
524 }
525
526 void ReadyRestart()
527 {
528         // no arena, assault support yet...
529         if(g_arena | g_assault | gameover | intermission_running | race_completing)
530                 localcmd("restart\n");
531
532         // reset ALL scores
533         Score_ClearAll();
534
535         ReadyRestartForce();
536 }
537
538 /**
539  * Counts how many players are ready. If not enough players are ready, the function
540  * does nothing. If all players are ready, the timelimit will be extended and the
541  * restart_countdown variable is set to allow other functions like PlayerPostThink
542  * to detect that the countdown is now active. If the cvar sv_ready_restart_after_countdown
543  * is not set the map will be resetted.
544  * 
545  * Function is called after the server receives a 'ready' sign from a player.
546  */
547 void ReadyCount()
548 {
549         local entity e;
550         local float r, p;
551
552         r = p = 0;
553
554         FOR_EACH_REALPLAYER(e)
555         {
556                 p += 1;
557                 if(e.ready)
558                         r += 1;
559         }
560
561         readycount = r;
562
563         Nagger_ReadyCounted();
564
565         if(r) // at least one is ready
566         if(r == p) // and, everyone is ready
567                 ReadyRestart();
568 }
569
570 /**
571  * Shows the restart countdown for all players.
572  * Plays the countdown sounds for the seconds 3, 2 1, begin for everyone.
573  * Restarts the map after the countdown is over (and cvar sv_ready_restart_after_countdown
574  * is set to 1).
575  */
576 void restartAnnouncer_Think() {
577         local entity plr;
578         local string s;
579         float f, c;
580         c = game_starttime - time;
581         f = floor(0.5 + c);
582         if(c <= 0) { //show the "Begin" message and
583                 if(self.spawnflags & 1)
584                 {
585                         restart_mapalreadyrestarted = 1;
586                         reset_map();
587                 }
588
589                 FOR_EACH_REALCLIENT(plr) {
590                         if(plr.classname == "player") {
591                                 s = strcat(NEWLINES, "^1Begin!");
592                                 centerprint(plr, s);
593                         }
594                 }
595                 play2all("announcer/robotic/begin.wav");
596
597                 remove(self);
598                 return;
599         }
600         else {
601                 FOR_EACH_REALCLIENT(plr) {
602                         if(plr.classname == "player") {
603                                 s = strcat(NEWLINES, "^1Game starts in ", ftos(f), " seconds");
604                                 centerprint(plr, s);
605                         }
606                 }
607
608                 if(f <= 3) {
609                         play2all(strcat("announcer/robotic/", ftos(f), ".wav"));
610                 }
611                 self.nextthink = game_starttime - (f - 1);
612         }
613 }
614
615 /**
616  * Checks whether the player who calls the timeout is allowed to do so.
617  * If so, it initializes the timeout countdown. It also checks whether another
618  * timeout was already running at this time and reacts correspondingly.
619  *
620  * affected globals/fields: .allowedTimeouts, remainingTimeoutTime, remainingLeadTime,
621  *                          timeoutInitiator, timeoutStatus, timeoutHandler
622  *
623  * This function is called when a player issues the calltimeout command.
624  */
625 void evaluateTimeoutCall() {
626         if (inWarmupStage && !g_warmup_allow_timeout)
627                 return sprint(self, "^7Error: You can not call a timeout in warmup-stage!\n");
628         if (time < game_starttime )
629                 return sprint(self, "^7Error: You can not call a timeout while the map is being restarted!\n");
630         if (timeoutStatus != 2) {
631                 //if the map uses a timelimit make sure that timeout cannot be called right before the map ends
632                 if (cvar("timelimit")) {
633                         //a timelimit was used
634                         local float myTl;
635                         myTl = cvar("timelimit");
636
637                         local float lastPossibleTimeout;
638                         lastPossibleTimeout = (myTl*60) - cvar("sv_timeout_leadtime") - 1;
639
640                         if (lastPossibleTimeout < time - game_starttime)
641                                 return sprint(self, "^7Error: It is too late to call a timeout now!\n");
642                 }
643         }
644         //player may not call a timeout if he has no calls left
645         if (self.allowedTimeouts < 1)
646                 return sprint(self, "^7Error: You already used all your timeout calls for this map!\n");
647         //now all required checks are passed
648         self.allowedTimeouts -= 1;
649         bprint(self.netname, " ^7called a timeout (", ftos(self.allowedTimeouts), " timeouts left)!\n"); //write a bprint who started the timeout (and how many he has left)
650         remainingTimeoutTime = cvar("sv_timeout_length");
651         remainingLeadTime = cvar("sv_timeout_leadtime");
652         timeoutInitiator = self;
653         if (timeoutStatus == 0) { //if another timeout was already active, don't change its status (which was 1 or 2) to 1, only change it to 1 if no timeout was active yet
654                 timeoutStatus = 1;
655                 //create the timeout indicator which centerprints the information to all players and takes care of pausing/unpausing
656                 timeoutHandler = spawn();
657                 timeoutHandler.think = timeoutHandler_Think;
658         }
659         timeoutHandler.nextthink = time; //always let the entity think asap
660
661         //inform all connected clients about the timeout call
662         play2all("announcer/robotic/timeoutcalled.wav");
663 }
664
665 /**
666  * Checks whether a player is allowed to resume the game. If he is allowed to do it,
667  * and the lead time for the timeout is still active, this countdown just will be aborted (the
668  * game will never be paused). Otherwise the remainingTimeoutTime will be set to the corresponding
669  * value of the cvar sv_timeout_resumetime.
670  *
671  * This function is called when a player issues the resumegame command.
672  */
673 void evaluateResumeGame() {
674         if (!timeoutStatus)
675                 return sprint(self, "^7Error: There is no active timeout which could be aborted!\n");
676         if (self != timeoutInitiator)
677                 return sprint(self, "^7Error: You may not abort the active timeout. Only the player who called it can do that!\n");
678         if (timeoutStatus == 1) {
679                 remainingTimeoutTime = timeoutStatus = 0;
680                 timeoutHandler.nextthink = time; //timeoutHandler has to take care of it immediately
681                 bprint(strcat("^7The timeout was aborted by ", self.netname, " !\n"));
682         }
683         else if (timeoutStatus == 2) {
684                 //only shorten the remainingTimeoutTime if it makes sense
685                 if( remainingTimeoutTime > (cvar("sv_timeout_resumetime") + 1) ) {
686                         bprint(strcat("^1Attention: ^7", self.netname, " resumed the game! Prepare for battle!\n"));
687                         remainingTimeoutTime = cvar("sv_timeout_resumetime");
688                         timeoutHandler.nextthink = time; //timeoutHandler has to take care of it immediately
689                 }
690                 else
691                         sprint(self, "^7Error: Your resumegame call was discarded!\n");
692
693         }
694 }