- }
- return; // never fall through to usage
- }
-
- default:
- case CC_REQUEST_USAGE:
- {
- sprint(self, "\nUsage:^3 cmd timein\n");
- sprint(self, " No arguments required.\n");
- return;
- }
- }
-}
-
-void ClientCommand_timeout(float request) // DEAR GOD THIS COMMAND IS TERRIBLE.
-{
- switch(request)
- {
- case CC_REQUEST_COMMAND:
- {
- if(self.flags & FL_CLIENT)
- {
- if(autocvar_sv_timeout)
- {
- if(self.classname == "player")
- {
- if(votecalled)
- sprint(self, "^7Error: you can not call a timeout while a vote is active!\n");
- else
- {
- if (inWarmupStage && !g_warmup_allow_timeout)
- return sprint(self, "^7Error: You can not call a timeout in warmup-stage!\n");
- if (time < game_starttime )
- return sprint(self, "^7Error: You can not call a timeout while the map is being restarted!\n");
-
- if (timeoutStatus != 2) {
- //if the map uses a timelimit make sure that timeout cannot be called right before the map ends
- if (autocvar_timelimit) {
- //a timelimit was used
- float myTl;
- myTl = autocvar_timelimit;
-
- float lastPossibleTimeout;
- lastPossibleTimeout = (myTl*60) - autocvar_sv_timeout_leadtime - 1;
-
- if (lastPossibleTimeout < time - game_starttime)
- return sprint(self, "^7Error: It is too late to call a timeout now!\n");
- }
- }
-
- //player may not call a timeout if he has no calls left
- if (self.allowedTimeouts < 1)
- return sprint(self, "^7Error: You already used all your timeout calls for this map!\n");
-
-
- //now all required checks are passed
- self.allowedTimeouts -= 1;
- 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)
- remainingTimeoutTime = autocvar_sv_timeout_length;
- remainingLeadTime = autocvar_sv_timeout_leadtime;
- timeoutInitiator = self;
- 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
- timeoutStatus = 1;
- //create the timeout indicator which centerprints the information to all players and takes care of pausing/unpausing
- timeoutHandler = spawn();
- timeoutHandler.think = timeoutHandler_Think;
- }
- timeoutHandler.nextthink = time; //always let the entity think asap
-
- //inform all connected clients about the timeout call
- Announce("timeoutcalled");
- }
- }
- else
- sprint(self, "^7Error: only players can call a timeout!\n");