78 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			SourcePawn
		
	
	
	
	
	
			
		
		
	
	
			78 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			SourcePawn
		
	
	
	
	
	
#include <sourcemod>
 | 
						|
#include <cstrike>
 | 
						|
#include <zombiereloaded>
 | 
						|
 | 
						|
public Plugin myinfo =
 | 
						|
{
 | 
						|
	name        = "InfectionExploitFix",
 | 
						|
	author      = "zaCade & Neon",
 | 
						|
	description = "Fixes Infection Dodge Exploit",
 | 
						|
	version     = "1.0",
 | 
						|
	url         = ""
 | 
						|
}
 | 
						|
 | 
						|
#pragma semicolon 1
 | 
						|
#pragma newdecls required
 | 
						|
 | 
						|
bool g_bZombieSpawned = false;
 | 
						|
bool g_bCriticalWindow = false;
 | 
						|
 | 
						|
Handle g_hTimerHandle = INVALID_HANDLE;
 | 
						|
 | 
						|
public void OnPluginStart()
 | 
						|
{
 | 
						|
	HookEvent("player_spawn",     OnPlayerSpawn, EventHookMode_Post);
 | 
						|
	HookEvent("round_freeze_end", OnRoundStart,  EventHookMode_PostNoCopy);
 | 
						|
	HookEvent("round_end",        OnRoundEnd,    EventHookMode_PostNoCopy);
 | 
						|
}
 | 
						|
 | 
						|
public void OnMapStart()
 | 
						|
{
 | 
						|
	g_bZombieSpawned = false;
 | 
						|
	g_bCriticalWindow = false;
 | 
						|
}
 | 
						|
 | 
						|
public void OnRoundStart(Event event, const char[] name, bool dontBroadcast)
 | 
						|
{
 | 
						|
	g_hTimerHandle = CreateTimer(20.0, PreventSpawnExploitStop, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
 | 
						|
 | 
						|
	g_bZombieSpawned = false;
 | 
						|
	g_bCriticalWindow = true;
 | 
						|
}
 | 
						|
 | 
						|
public void OnRoundEnd(Event event, const char[] name, bool dontBroadcast)
 | 
						|
{
 | 
						|
	if (g_hTimerHandle != INVALID_HANDLE && KillTimer(g_hTimerHandle))
 | 
						|
		g_hTimerHandle = INVALID_HANDLE;
 | 
						|
 | 
						|
	g_bZombieSpawned = false;
 | 
						|
	g_bCriticalWindow = false;
 | 
						|
}
 | 
						|
 | 
						|
public void OnPlayerSpawn(Event event, const char[] name, bool dontBroadcast)
 | 
						|
{
 | 
						|
	int client = GetClientOfUserId(event.GetInt("userid"));
 | 
						|
 | 
						|
	if (g_bZombieSpawned && g_bCriticalWindow && GetClientTeam(client) >= CS_TEAM_T)
 | 
						|
		 RequestFrame(OnPlayerSpawnPost, client);
 | 
						|
}
 | 
						|
 | 
						|
public void OnPlayerSpawnPost(int client)
 | 
						|
{
 | 
						|
	if (IsClientInGame(client) && IsPlayerAlive(client))
 | 
						|
		ZR_InfectClient(client);
 | 
						|
}
 | 
						|
 | 
						|
public Action ZR_OnClientInfect(int &client, int &attacker, bool &motherInfect, bool &respawnOverride, bool &respawn)
 | 
						|
{
 | 
						|
	if (!g_bZombieSpawned && motherInfect)
 | 
						|
		g_bZombieSpawned = true;
 | 
						|
}
 | 
						|
 | 
						|
public Action PreventSpawnExploitStop(Handle timer)
 | 
						|
{
 | 
						|
	if (g_hTimerHandle != INVALID_HANDLE)
 | 
						|
		g_hTimerHandle = INVALID_HANDLE;
 | 
						|
 | 
						|
	g_bCriticalWindow = false;
 | 
						|
} |