]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/clientcommands.qc
add a "selfstuff" clientcommand to embed stuff into a demo
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / clientcommands.qc
1 entity nagger;
2 float readycount;
3
4 float Nagger_SendEntity(entity to, float sendflags)
5 {
6         float nags, i, f, b;
7         entity e;
8         WriteByte(MSG_ENTITY, ENT_CLIENT_NAGGER);
9
10         // bits:
11         //   1 = ready
12         //   2 = player needs to ready up
13         //   4 = vote
14         //   8 = player needs to vote
15         //  16 = warmup
16         // sendflags:
17         //  64 = vote counts
18         // 128 = vote string
19
20         nags = 0;
21         if(readycount)
22         {
23                 nags |= 1;
24                 if(to.ready == 0)
25                         nags |= 2;
26         }
27         if(votecalled)
28         {
29                 nags |= 4;
30                 if(to.vote_vote == 0)
31                         nags |= 8;
32         }
33         if(inWarmupStage)
34                 nags |= 16;
35
36         if(sendflags & 64)
37                 nags |= 64;
38
39         if(sendflags & 128)
40                 nags |= 128;
41
42         if(!(nags & 4)) // no vote called? send no string
43                 nags &~= (64 | 128);
44
45         WriteByte(MSG_ENTITY, nags);
46
47         if(nags & 64)
48         {
49                 WriteByte(MSG_ENTITY, vote_yescount);
50                 WriteByte(MSG_ENTITY, vote_nocount);
51                 WriteByte(MSG_ENTITY, vote_needed_absolute);
52                 WriteChar(MSG_ENTITY, to.vote_vote);
53         }
54
55         if(nags & 128)
56                 WriteString(MSG_ENTITY, votecalledvote_display);
57
58         if(nags & 1)
59         {
60                 for(i = 1; i <= maxclients; i += 8)
61                 {
62                         for(f = 0, e = edict_num(i), b = 1; b < 256; b *= 2, e = nextent(e))
63                                 if(clienttype(e) != CLIENTTYPE_REAL || e.ready)
64                                         f |= b;
65                         WriteByte(MSG_ENTITY, f);
66                 }
67         }
68
69         return TRUE;
70 }
71 void Nagger_Init()
72 {
73         Net_LinkEntity(nagger = spawn(), FALSE, 0, Nagger_SendEntity);
74 }
75 void Nagger_VoteChanged()
76 {
77         if(nagger)
78                 nagger.SendFlags |= 128;
79 }
80 void Nagger_VoteCountChanged()
81 {
82         if(nagger)
83                 nagger.SendFlags |= 64;
84 }
85 void Nagger_ReadyCounted()
86 {
87         if(nagger)
88                 nagger.SendFlags |= 1;
89 }
90
91 void ReadyCount();
92 string MapVote_Suggest(string m);
93
94 entity GetPlayer(string name)
95 {
96         float num;
97         entity e;
98         string ns;
99
100         if(substring(name, 0, 1) == "#") {
101                 num = stof(substring(name, 1, 999));
102                 if(num >= 1 && num <= maxclients) {
103                         for((e = world); num > 0; --num, (e = nextent(e)))
104                                 ;
105                         //if(clienttype(e) == CLIENTTYPE_REAL)
106                         if(e.classname == "player")
107                                 return e;
108                 }
109         } else {
110                 ns = strdecolorize(name);
111                 FOR_EACH_REALPLAYER(e) {
112                         if(!strcasecmp(strdecolorize(e.netname), ns)) {
113                                 return e;
114                         }
115                 }
116         }
117         return world;
118 }
119
120 //float ctf_clientcommand();
121 float readyrestart_happened;
122 .float lms_spectate_warning;
123 void spawnfunc_func_breakable();
124
125 .float cmd_floodtime;
126 .float cmd_floodcount;
127 float cmd_floodcheck()
128 {
129         if (timeoutStatus != 2)
130         {
131                 if(time == self.cmd_floodtime)
132                 {
133                         self.cmd_floodcount += 1;
134                         if(self.cmd_floodcount > 8)
135                                 return TRUE;
136                 }
137                 else
138                 {
139                         self.cmd_floodtime = time;
140                         self.cmd_floodcount = 1;
141                 }
142         }
143         return FALSE;
144 }
145
146 .float checkfail;
147 void SV_ParseClientCommand(string s) {
148         float i;
149         entity e;
150
151         cmd_argc = tokenize_console(s);
152         cmd_string = s;
153         cmd_name = strtolower(argv(0));
154         if(cmd_name != "reportcvar")
155         if(cmd_name != "sentcvar")
156         if(cmd_name != "pause")
157         if(cmd_name != "prespawn")
158         if(cmd_name != "spawn")
159         if(cmd_name != "begin")
160         {
161                 if(cmd_floodcheck())
162                         return;
163         }
164
165         if(MUTATOR_CALLHOOK(SV_ParseClientCommand))
166                 return; // already handled
167         
168         if(GameCommand_Vote(s, self)) {
169                 return;
170         } else if(GameCommand_MapVote(argv(0))) {
171                 return;
172         } else if(cmd_name == "checkfail") {
173                 print(sprintf("CHECKFAIL: %s (%s) epically failed check %s\n", self.netname, self.netaddress, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1))));
174                 self.checkfail = 1;
175         } else if(cmd_name == "autoswitch") {
176                 // be backwards compatible with older clients (enabled)
177                 self.autoswitch = ("0" != argv(1));
178                 string autoswitchmsg;
179                 if (self.autoswitch) {
180                         autoswitchmsg = "on";
181                 } else {
182                         autoswitchmsg = "off";
183                 }
184                 sprint(self, strcat("^1autoswitch turned ", autoswitchmsg, "\n"));
185         } else if(cmd_name == "clientversion") {
186                 if not(self.flags & FL_CLIENT)
187                         return;
188                 if (argv(1) == "$gameversion") {
189                         //versionmsg = "^1client is too old to get versioninfo.\nUPDATE!!! (http://www.xonotic.com)^8";
190                         // either that or someone wants to be funny
191                         self.version = 1;
192                 } else {
193                         self.version = stof(argv(1));
194                 }
195                 if(self.version < autocvar_gameversion_min || self.version > autocvar_gameversion_max)
196                 {
197                         self.version_mismatch = 1;
198                         ClientKill_TeamChange(-2); // observe
199                 } else if(autocvar_g_campaign || autocvar_g_balance_teams || autocvar_g_balance_teams_force) {
200                         //JoinBestTeam(self, FALSE, TRUE);
201                 } else if(teamplay && !autocvar_sv_spectate && !(self.team_forced > 0)) {
202                         self.classname = "observer";
203                         stuffcmd(self,"menu_showteamselect\n");
204                 }
205         } else if(cmd_name == "reportcvar") { // old system
206                 if(substring(argv(2), 0, 1) == "$") // undefined cvar: use the default value on the server then
207                 {
208                         s = strcat(substring(s, argv_start_index(0), argv_end_index(1) - argv_start_index(0)), " \"", cvar_defstring(argv(1)), "\"");
209                         cmd_argc = tokenize_console(s);
210                 }
211                 GetCvars(1);
212         } else if(cmd_name == "sentcvar") { // new system
213                 if(cmd_argc == 2) // undefined cvar: use the default value on the server then
214                 {
215                         s = strcat(substring(s, argv_start_index(0), argv_end_index(1) - argv_start_index(0)), " \"", cvar_defstring(argv(1)), "\"");
216                         cmd_argc = tokenize_console(s);
217                 }
218                 GetCvars(1);
219         } else if(cmd_name == "spectate") {
220                 if(cmd_floodcheck())
221                         return;
222                 if not(self.flags & FL_CLIENT)
223                         return;
224                 if(g_arena)
225                         return;
226                 if(g_lms)
227                 {
228                         if(self.lms_spectate_warning)
229                         {
230                                 // mark player as spectator
231                                 PlayerScore_Add(self, SP_LMS_RANK, 666 - PlayerScore_Add(self, SP_LMS_RANK, 0));
232                         }
233                         else
234                         {
235                                 self.lms_spectate_warning = 1;
236                                 sprint(self, "WARNING: you won't be able to enter the game again after spectating in LMS. Use the same command again to spectate anyway.\n");
237                                 return;
238                         }
239                 }
240                 if(self.classname == "player" && autocvar_sv_spectate == 1) {
241                         ClientKill_TeamChange(-2); // observe
242                 }
243                 if(g_ca && self.caplayer && (self.classname == "spectator" || self.classname == "observer")) {
244                         // in CA, allow a dead player to move to spectatators (without that, caplayer!=0 will be moved back to the player list)
245                         sprint(self, "WARNING: you will spectate in the next round.\n");
246                         self.caplayer = 0;
247                 }
248         } else if(cmd_name == "join") {
249                 if not(self.flags & FL_CLIENT)
250                         return;
251                 if(!g_arena)
252                 if (self.classname != "player" && !lockteams)
253                 {
254                         if(nJoinAllowed(1)) {
255                                 self.classname = "player";
256                                 if(g_ca)
257                                         self.caplayer = 1;
258                                 PlayerScore_Clear(self);
259                                 bprint ("^4", self.netname, "^4 is playing now\n");
260                                 PutClientInServer();
261                                 if(autocvar_g_campaign)
262                                         campaign_bots_may_start = 1;
263                         }
264                         else {
265                                 //player may not join because of g_maxplayers is set
266                                 centerprint(self, PREVENT_JOIN_TEXT);
267                         }
268                 }
269         } else if( cmd_name == "selectteam" ) {
270                 if not(self.flags & FL_CLIENT)
271                         return;
272                 if( !teamplay ) {
273                         sprint( self, "selectteam can only be used in teamgames\n");
274                 } else if(autocvar_g_campaign) {
275                         //JoinBestTeam(self, 0);
276                 } else if(self.team_forced > 0) {
277                         sprint( self, "selectteam can not be used as your team is forced\n");
278                 } else if(lockteams) {
279                         sprint( self, "^7The game has already begun, you must wait until the next map to be able to join a team.\n");
280                 } else if( argv(1) == "red" ) {
281                         if(self.team != COLOR_TEAM1 || self.deadflag != DEAD_NO)
282                                 ClientKill_TeamChange(COLOR_TEAM1);
283                         else
284                                 sprint( self, "^7You already are on that team.\n");
285                 } else if( argv(1) == "blue" ) {
286                         if(self.team != COLOR_TEAM2 || self.deadflag != DEAD_NO)
287                                 ClientKill_TeamChange(COLOR_TEAM2);
288                         else
289                                 sprint( self, "^7You already are on that team.\n");
290                 } else if( argv(1) == "yellow" ) {
291                         if(self.team != COLOR_TEAM3 || self.deadflag != DEAD_NO)
292                                 ClientKill_TeamChange(COLOR_TEAM3);
293                         else
294                                 sprint( self, "^7You already are on that team.\n");
295                 } else if( argv(1) == "pink" ) {
296                         if(self.team != COLOR_TEAM4 || self.deadflag != DEAD_NO)
297                                 ClientKill_TeamChange(COLOR_TEAM4);
298                         else
299                                 sprint( self, "^7You already are on that team.\n");
300                 } else if( argv(1) == "auto" ) {
301                         ClientKill_TeamChange(-1);
302                 } else {
303                         sprint( self, strcat( "selectteam none/red/blue/yellow/pink/auto - \"", argv(1), "\" not recognised\n" ) );
304                 }
305         } else if(cmd_name == "ready") {
306                 if not(self.flags & FL_CLIENT)
307                         return;
308
309                 if((inWarmupStage)
310                    || autocvar_sv_ready_restart || g_race_qualifying == 2)
311                 {
312                         if(!readyrestart_happened || autocvar_sv_ready_restart_repeatable)
313                         {
314                                 if (self.ready) // toggle
315                                 {
316                                         self.ready = FALSE;
317                                         bprint(self.netname, "^2 is ^1NOT^2 ready\n");
318                                 }
319                                 else
320                                 {
321                                         self.ready = TRUE;
322                                         bprint(self.netname, "^2 is ready\n");
323                                 }
324
325                                 // cannot reset the game while a timeout is active!
326                                 if(!timeoutStatus)
327                                         ReadyCount();
328                         } else {
329                                 sprint(self, "^1Game has already been restarted\n");
330                         }
331                 }
332         } else if(cmd_name == "maplist") {
333                 sprint(self, maplist_reply);
334         } else if(cmd_name == "lsmaps") {
335                 sprint(self, lsmaps_reply);
336         } else if(cmd_name == "lsnewmaps") {
337                 sprint(self, lsnewmaps_reply);
338         } else if(cmd_name == "records") {
339                 for(i = 0; i < 10; ++i)
340                         sprint(self, records_reply[i]);
341         } else if(cmd_name == "ladder") {
342                 sprint(self, ladder_reply);
343         } else if(cmd_name == "rankings") {
344                 sprint(self, rankings_reply);
345         } else if(cmd_name == "voice") {
346                 if(cmd_argc >= 3)
347                         VoiceMessage(argv(1), substring(s, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
348                 else
349                         VoiceMessage(argv(1), "");
350         } else if(cmd_name == "say") {
351                 if(cmd_argc >= 2)
352                         Say(self, FALSE, world, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1);
353                 //clientcommand(self, formatmessage(s));
354         } else if(cmd_name == "say_team") {
355                 if(cmd_argc >= 2)
356                         Say(self, TRUE, world, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1);
357                 //clientcommand(self, formatmessage(s));
358         } else if(cmd_name == "selfstuff") {
359                 // this command mainly serves to embed a command to be executed into a demo (HINT: use settemp)
360                 stuffcmd(self, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
361         } else if(cmd_name == "tell") {
362                 e = GetCommandPlayerSlotTargetFromTokenizedCommand(cmd_argc, 1);
363                 if(e && cmd_argc > ParseCommandPlayerSlotTarget_firsttoken)
364                 {
365                         Say(self, FALSE, e, substring(s, argv_start_index(ParseCommandPlayerSlotTarget_firsttoken), argv_end_index(-1) - argv_start_index(ParseCommandPlayerSlotTarget_firsttoken)), TRUE);
366                 }
367                 else
368                 {
369                         if(cmd_argc > ParseCommandPlayerSlotTarget_firsttoken)
370                                 trigger_magicear_processmessage_forallears(self, -1, world, substring(s, argv_start_index(ParseCommandPlayerSlotTarget_firsttoken), argv_end_index(-1) - argv_start_index(ParseCommandPlayerSlotTarget_firsttoken)));
371                         sprint(self, "ERROR: usage: tell # playerid text...\n");
372                 }
373                 //clientcommand(self, formatmessage(s));
374         } else if(cmd_name == "info") {
375                 cmd_name = builtin_cvar_string(strcat("sv_info_", argv(1))); // This needed fixed for the cvar check
376                 if(cmd_name == "")
377                         sprint(self, "ERROR: unsupported info command\n");
378                 else
379                         wordwrap_sprint(cmd_name, 1111);
380         } else if(cmd_name == "suggestmap") {
381                 sprint(self, strcat(MapVote_Suggest(argv(1)), "\n"));
382         } else if(cmd_name == "timeout") {
383                 if not(self.flags & FL_CLIENT)
384                         return;
385                 if(autocvar_sv_timeout) {
386                         if(self.classname == "player") {
387                                 if(votecalled)
388                                         sprint(self, "^7Error: you can not call a timeout while a vote is active!\n");
389                                 else
390                                         evaluateTimeout();
391                         }
392                         else
393                                 sprint(self, "^7Error: only players can call a timeout!\n");
394                 }
395         } else if(cmd_name == "timein") {
396                 if not(self.flags & FL_CLIENT)
397                         return;
398                 if(autocvar_sv_timeout) {
399                         evaluateTimein();
400                 }
401         } else if(cmd_name == "teamstatus") {
402                 Score_NicePrint(self);
403         } else if(cmd_name == "cvar_changes") {
404                 sprint(self, cvar_changes);
405         } else if(cmd_name == "cvar_purechanges") {
406                 sprint(self, cvar_purechanges);
407         } else if(CheatCommand(cmd_argc)) {
408         } else {
409 #if 0
410                 //if(ctf_clientcommand())
411                 //      return;
412                 // grep for Cmd_AddCommand_WithClientCommand to find them all
413                 if(cmd_name != "status")
414                 //if(cmd_name != "say") // handled above
415                 //if(cmd_name != "say_team") // handled above
416                 if(cmd_name != "kill")
417                 if(cmd_name != "pause")
418                 if(cmd_name != "ping")
419                 if(cmd_name != "name")
420                 if(cmd_name != "color")
421                 if(cmd_name != "rate")
422                 if(cmd_name != "pmodel")
423                 if(cmd_name != "playermodel")
424                 if(cmd_name != "playerskin")
425                 if(cmd_name != "prespawn")
426                 if(cmd_name != "spawn")
427                 if(cmd_name != "begin")
428                 if(cmd_name != "pings")
429                 if(cmd_name != "sv_startdownload")
430                 if(cmd_name != "download")
431                 {
432                         print("WARNING: Invalid clientcommand by ", self.netname, ": ", s, "\n");
433                         return;
434                 }
435 #endif
436
437                 if(self.jointime > 0 && time > self.jointime + 10 && time > self.nickspamtime) // allow any changes in the first 10 seconds since joining
438                 if(cmd_name == "name" || cmd_name == "playermodel") // TODO also playerskin and color?
439                 {
440                         if(self.nickspamtime == 0 || time > self.nickspamtime + autocvar_g_nick_flood_timeout)
441                                 // good, no serious flood
442                                 self.nickspamcount = 1;
443                         else
444                                 self.nickspamcount += 1;
445                         self.nickspamtime = time + autocvar_g_nick_flood_penalty;
446
447                         if (timeoutStatus == 2) //when game is paused, no flood protection
448                                 self.nickspamcount = self.nickspamtime = 0;
449                 }
450
451                 clientcommand(self,s);
452         }
453 }
454
455 void ReadyRestartForce()
456 {
457         entity e;
458
459         bprint("^1Server is restarting...\n");
460
461         VoteReset();
462
463         // clear overtime
464         if (checkrules_overtimesadded > 0 && g_race_qualifying != 2) {
465                 //we have to decrease timelimit to its original value again!!
466                 float newTL;
467                 newTL = autocvar_timelimit;
468                 newTL -= checkrules_overtimesadded * autocvar_timelimit_overtime;
469                 cvar_set("timelimit", ftos(newTL));
470         }
471
472         checkrules_suddendeathend = checkrules_overtimesadded = checkrules_suddendeathwarning = 0;
473
474
475         readyrestart_happened = 1;
476         game_starttime = time;
477         if(!g_ca && !g_arena)
478                 game_starttime += RESTART_COUNTDOWN;
479         restart_mapalreadyrestarted = 0; //reset this var, needed when cvar sv_ready_restart_repeatable is in use
480
481         inWarmupStage = 0; //once the game is restarted the game is in match stage
482
483         //reset the .ready status of all players (also spectators)
484         FOR_EACH_CLIENTSLOT(e)
485                 e.ready = 0;
486         readycount = 0;
487         Nagger_ReadyCounted(); // NOTE: this causes a resend of that entity, and will also turn off warmup state on the client
488
489         if(autocvar_teamplay_lockonrestart && teamplay) {
490                 lockteams = 1;
491                 bprint("^1The teams are now locked.\n");
492         }
493
494         //initiate the restart-countdown-announcer entity
495         if(autocvar_sv_ready_restart_after_countdown && !g_ca && !g_arena)
496         {
497                 restartTimer = spawn();
498                 restartTimer.think = restartTimer_Think;
499                 restartTimer.nextthink = game_starttime;
500         }
501
502         //after a restart every players number of allowed timeouts gets reset, too
503         if(autocvar_sv_timeout)
504         {
505                 FOR_EACH_REALPLAYER(e)
506                         e.allowedTimeouts = autocvar_sv_timeout_number;
507         }
508
509         //reset map immediately if this cvar is not set
510         if (!autocvar_sv_ready_restart_after_countdown)
511                 reset_map(TRUE);
512
513         if(autocvar_sv_eventlog)
514                 GameLogEcho(":restart");
515 }
516
517 void ReadyRestart()
518 {
519         // no arena, assault support yet...
520         if(g_arena | g_assault | gameover | intermission_running | race_completing)
521                 localcmd("restart\n");
522         else
523                 localcmd("\nsv_hook_gamerestart\n");
524
525         ReadyRestartForce();
526
527         // reset ALL scores, but only do that at the beginning
528         //of the countdown if sv_ready_restart_after_countdown is off!
529         //Otherwise scores could be manipulated during the countdown!
530         if (!autocvar_sv_ready_restart_after_countdown)
531                 Score_ClearAll();
532 }
533
534 /**
535  * Counts how many players are ready. If not enough players are ready, the function
536  * does nothing. If all players are ready, the timelimit will be extended and the
537  * restart_countdown variable is set to allow other functions like PlayerPostThink
538  * to detect that the countdown is now active. If the cvar sv_ready_restart_after_countdown
539  * is not set the map will be resetted.
540  *
541  * Function is called after the server receives a 'ready' sign from a player.
542  */
543 void ReadyCount()
544 {
545         entity e;
546         float r, p;
547
548         r = p = 0;
549
550         FOR_EACH_REALPLAYER(e)
551         {
552                 p += 1;
553                 if(e.ready)
554                         r += 1;
555         }
556
557         readycount = r;
558
559         Nagger_ReadyCounted();
560
561         if(r) // at least one is ready
562         if(r == p) // and, everyone is ready
563                 ReadyRestart();
564 }
565
566 /**
567  * Restarts the map after the countdown is over (and cvar sv_ready_restart_after_countdown
568  * is set)
569  */
570 void restartTimer_Think() {
571         restart_mapalreadyrestarted = 1;
572         reset_map(TRUE);
573         Score_ClearAll();
574         remove(self);
575         return;
576 }
577
578 /**
579  * Checks whether the player who calls the timeout is allowed to do so.
580  * If so, it initializes the timeout countdown. It also checks whether another
581  * timeout was already running at this time and reacts correspondingly.
582  *
583  * affected globals/fields: .allowedTimeouts, remainingTimeoutTime, remainingLeadTime,
584  *                          timeoutInitiator, timeoutStatus, timeoutHandler
585  *
586  * This function is called when a player issues the calltimeout command.
587  */
588 void evaluateTimeout() {
589         if (inWarmupStage && !g_warmup_allow_timeout)
590                 return sprint(self, "^7Error: You can not call a timeout in warmup-stage!\n");
591         if (time < game_starttime )
592                 return sprint(self, "^7Error: You can not call a timeout while the map is being restarted!\n");
593         if (timeoutStatus != 2) {
594                 //if the map uses a timelimit make sure that timeout cannot be called right before the map ends
595                 if (autocvar_timelimit) {
596                         //a timelimit was used
597                         float myTl;
598                         myTl = autocvar_timelimit;
599
600                         float lastPossibleTimeout;
601                         lastPossibleTimeout = (myTl*60) - autocvar_sv_timeout_leadtime - 1;
602
603                         if (lastPossibleTimeout < time - game_starttime)
604                                 return sprint(self, "^7Error: It is too late to call a timeout now!\n");
605                 }
606         }
607         //player may not call a timeout if he has no calls left
608         if (self.allowedTimeouts < 1)
609                 return sprint(self, "^7Error: You already used all your timeout calls for this map!\n");
610         //now all required checks are passed
611         self.allowedTimeouts -= 1;
612         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)
613         remainingTimeoutTime = autocvar_sv_timeout_length;
614         remainingLeadTime = autocvar_sv_timeout_leadtime;
615         timeoutInitiator = self;
616         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
617                 timeoutStatus = 1;
618                 //create the timeout indicator which centerprints the information to all players and takes care of pausing/unpausing
619                 timeoutHandler = spawn();
620                 timeoutHandler.think = timeoutHandler_Think;
621         }
622         timeoutHandler.nextthink = time; //always let the entity think asap
623
624         //inform all connected clients about the timeout call
625         Announce("timeoutcalled");
626 }
627
628 /**
629  * Checks whether a player is allowed to resume the game. If he is allowed to do it,
630  * and the lead time for the timeout is still active, this countdown just will be aborted (the
631  * game will never be paused). Otherwise the remainingTimeoutTime will be set to the corresponding
632  * value of the cvar sv_timeout_resumetime.
633  *
634  * This function is called when a player issues the resumegame command.
635  */
636 void evaluateTimein() {
637         if (!timeoutStatus)
638                 return sprint(self, "^7Error: There is no active timeout which could be aborted!\n");
639         if (self != timeoutInitiator)
640                 return sprint(self, "^7Error: You may not abort the active timeout. Only the player who called it can do that!\n");
641         if (timeoutStatus == 1) {
642                 remainingTimeoutTime = timeoutStatus = 0;
643                 timeoutHandler.nextthink = time; //timeoutHandler has to take care of it immediately
644                 bprint(strcat("^7The timeout was aborted by ", self.netname, " !\n"));
645         }
646         else if (timeoutStatus == 2) {
647                 //only shorten the remainingTimeoutTime if it makes sense
648                 if( remainingTimeoutTime > (autocvar_sv_timeout_resumetime + 1) ) {
649                         bprint(strcat("^1Attention: ^7", self.netname, " resumed the game! Prepare for battle!\n"));
650                         remainingTimeoutTime = autocvar_sv_timeout_resumetime;
651                         timeoutHandler.nextthink = time; //timeoutHandler has to take care of it immediately
652                 }
653                 else
654                         sprint(self, "^7Error: Your resumegame call was discarded!\n");
655
656         }
657 }