TeamManager: retreive native call
thx zuff xD
This commit is contained in:
		
							parent
							
								
									27588cf2f0
								
							
						
					
					
						commit
						15c63febe2
					
				| @ -15,6 +15,7 @@ ConVar g_CVar_sm_warmuptime; | ||||
| ConVar g_CVar_sm_warmupratio; | ||||
| ConVar g_CVar_sm_warmupmaxtime; | ||||
| bool g_bLateLoad = false; | ||||
| Handle g_hWarmupEndFwd; | ||||
| 
 | ||||
| bool g_bRoundEnded = false; | ||||
| bool g_bZombieSpawned = false; | ||||
| @ -42,6 +43,8 @@ public void OnPluginStart() | ||||
| 	g_CVar_sm_warmupratio = CreateConVar("sm_warmupratio", "0.60", "Ratio of connected players that need to be in game to start warmup timer.", 0, true, 0.0, true, 1.0); | ||||
| 	g_CVar_sm_warmupmaxtime = CreateConVar("sm_warmupmaxtime", "45", "Max Warmup timer.", 0, true, 0.0, true, 120.0); | ||||
| 
 | ||||
| 	g_hWarmupEndFwd = CreateGlobalForward("TeamManager_WarmupEnd", ET_Ignore); | ||||
| 
 | ||||
| 	AutoExecConfig(true, "plugin.TeamManager"); | ||||
| 
 | ||||
| 	for(int i = 1; i <= MaxClients; i++) | ||||
| @ -56,6 +59,10 @@ public void OnPluginStart() | ||||
| 
 | ||||
| public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) | ||||
| { | ||||
| 	CreateNative("TeamManager_InWarmup", Native_InWarmup); | ||||
| 
 | ||||
| 	RegPluginLibrary("TeamManager"); | ||||
| 
 | ||||
| 	g_bLateLoad = late; | ||||
| 	return APLRes_Success; | ||||
| } | ||||
| @ -83,19 +90,13 @@ public void OnConfigsExecuted() | ||||
| 
 | ||||
| public Action OnWarmupTimer(Handle timer) | ||||
| { | ||||
| 	if(g_iMaxWarmup >= g_CVar_sm_warmupmaxtime.IntValue) | ||||
| 	if(g_iMaxWarmup >= g_CVar_sm_warmupmaxtime.IntValue || g_iWarmup >= g_CVar_sm_warmuptime.IntValue) | ||||
| 	{ | ||||
| 		g_iMaxWarmup = 0; | ||||
| 		g_bWarmup = false; | ||||
| 		CS_TerminateRound(3.0, CSRoundEnd_GameStart, false); | ||||
| 		return Plugin_Stop; | ||||
| 	} | ||||
| 
 | ||||
| 	if(g_iWarmup >= g_CVar_sm_warmuptime.IntValue) | ||||
| 	{ | ||||
| 		g_iWarmup = 0; | ||||
| 		g_bWarmup = false; | ||||
| 		CS_TerminateRound(3.0, CSRoundEnd_GameStart, false); | ||||
| 		float fDelay = 3.0; | ||||
| 		CS_TerminateRound(fDelay, CSRoundEnd_GameStart, false); | ||||
| 		CreateTimer(fDelay, Timer_FireForward, _, TIMER_FLAG_NO_MAPCHANGE); | ||||
| 		return Plugin_Stop; | ||||
| 	} | ||||
| 
 | ||||
| @ -123,6 +124,13 @@ public Action OnWarmupTimer(Handle timer) | ||||
| 	return Plugin_Continue; | ||||
| } | ||||
| 
 | ||||
| public Action Timer_FireForward(Handle hThis) | ||||
| { | ||||
| 	Call_StartForward(g_hWarmupEndFwd); | ||||
| 	Call_Finish(); | ||||
| 	return Plugin_Handled; | ||||
| } | ||||
| 
 | ||||
| public void OnClientDisconnect(int client) | ||||
| { | ||||
| 	g_TeamChangeQueue[client] = -1; | ||||
| @ -257,3 +265,8 @@ public Action ZR_OnInfectCountdown() | ||||
| 
 | ||||
| 	return Plugin_Continue; | ||||
| } | ||||
| 
 | ||||
| public int Native_InWarmup(Handle hPlugin, int numParams) | ||||
| { | ||||
| 	return g_bWarmup; | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user