Raised This Month: $51 Target: $400
 12% 

Solved [CSGO] Team Pause Timer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nextars
Junior Member
Join Date: Nov 2017
Old 05-23-2021 , 14:41   [CSGO] Team Pause Timer
Reply With Quote #1

how can I create something like both teams has a total timer of 300sec each they can type !pause to pause the match for 300 second but if they type !unpause before the time it will get stored and they can again use the !pause until the time finish for their team. How can I achieve this?
if anyone can help that will be great.
i m new to sourcepawn/programming ignore my mistakes.

HTML Code:
int timertimeT = 0;
int timertimeCT = 0;
bool Ttime = false;
bool CTtime = false;


public void OnPluginStart() {
	RegConsoleCmd("sm_pause", Command_Pause, "Requests a pause");
	RegConsoleCmd("sm_unpause", Command_Unpause, "Requests an unpause");
	
}

public Action Command_Pause(int client, int args) {
	if(GetClientTeam(client)==2){
		if(timertimeT>=5){
			PrintToChatAll("Terrorist has No Timeout Left.");
			return Plugin_Stop;
		}
		CreateTimer(1.0, PauseTimerTCheck, _, TIMER_REPEAT);
		ServerCommand("mp_pause_match");
		PrintToChatAll("Terrorist has requested a pause.");
		return Plugin_Handled;
	}
	if(GetClientTeam(client)==3){
		if(timertimeCT>=5){
			PrintToChatAll("Counter Terrorist has No Timeout Left.");
			return Plugin_Stop;
		}
		CreateTimer(1.0, PauseTimerCTCheck, _, TIMER_REPEAT);
		ServerCommand("mp_pause_match");
		PrintToChatAll("CT has requested a pause.");
		return Plugin_Handled;
	}
	return Plugin_Handled;
}

public Action Command_Unpause(int client, int args) {    
	if(GetClientTeam(client)==2){
		
	}
	if(GetClientTeam(client)==3){
		
	}
	return Plugin_Handled;
}



public Action PauseTimerTCheck(Handle timer){
	if (GameRules_GetProp("m_bFreezePeriod") != 0)
	{
		CreateTimer(60.0, PauseTimerT, _, TIMER_REPEAT);
	} 	
}
public Action PauseTimerCTCheck(Handle timer){
	if (GameRules_GetProp("m_bFreezePeriod") != 0)
	{
		CreateTimer(60.0, PauseTimerCT, _, TIMER_REPEAT);
	} 
}


public Action PauseTimerT(Handle timer){
	if(Ttime){
		return Plugin_Stop;
	}
	timertimeT++;
	if(timertimeT>=5){
		Ttime = true;
		ServerCommand("mp_unpause_match");
		PrintToChatAll("Terrorist Timeout Has Ended."); 
		
		return Plugin_Handled;
	}
	else if(timertimeT==4){
		PrintToChatAll("Terrorist 1 Minute Left.");  
		
	}
	else if(timertimeT==3){
		PrintToChatAll("Terrorist 2 Minute Left.");  
		
	}
	else if(timertimeT==2){
		PrintToChatAll("Terrorist 3 Minute Left.");  
		
	}
	else if(timertimeT==1){
		PrintToChatAll("Terrorist 4 Minute Left.");  
		
	}
	return Plugin_Continue;
}
public Action PauseTimerCT(Handle timer){
	if(CTtime){
		return Plugin_Stop;
	}
	timertimeCT++;
	if(timertimeCT<=5){
		CTtime = true;
		ServerCommand("mp_unpause_match");
		PrintToChatAll("Counter Terrorist Timeout Has Ended."); 
		
		return Plugin_Handled;
	}
	else if(timertimeCT==4){
		PrintToChatAll("Counter Terrorist 1 Minute Left.");  
		
	}
	else if(timertimeCT==3){
		PrintToChatAll("Counter Terrorist 2 Minute Left.");  
		
	}
	else if(timertimeCT==2){
		PrintToChatAll("Counter Terrorist 3 Minute Left.");  
		
	}
	else if(timertimeCT==1){
		PrintToChatAll("Counter Terrorist 4 Minute Left.");  
		
	}
	return Plugin_Continue;
}

Last edited by Nextars; 05-24-2021 at 07:29.
Nextars is offline
raj kaul
Senior Member
Join Date: Mar 2018
Location: www.lotgaming.xyz
Old 05-25-2021 , 13:05   Re: [CSGO] Team Pause Timer
Reply With Quote #2

you marked as Solved means this edited script is working fine for you? because i want same thing for my tournament servers where both team can take 5 minutes of tech pause using !tech command
__________________
raj kaul is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode