From db0de91a18e4147125d2e36b458bf08bc5422959 Mon Sep 17 00:00:00 2001 From: BotoX Date: Wed, 17 Feb 2016 00:48:42 +0100 Subject: [PATCH] fixed zspawn exploit (spawn as human after infection by suiciding and zspawning) --- src/zr/infect.inc | 2 ++ src/zr/zspawn.inc | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/zr/infect.inc b/src/zr/infect.inc index a7a56d7..5c32493 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -801,6 +801,7 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa ZHPOnClientInfected(client); APIOnClientInfected(client, attacker, motherinfect, respawnoverride, respawn); ImmunityOnClientInfected(client); + ZSpawnOnClientInfected(client); } /** @@ -867,6 +868,7 @@ InfectZombieToHuman(client, bool:respawn = false, bool:protect = false) SEffectsOnClientHuman(client); APIOnClientHumanPost(client, respawn, protect); ImmunityOnClientHuman(client); + ZSpawnOnClientHuman(client); } /** diff --git a/src/zr/zspawn.inc b/src/zr/zspawn.inc index fd34025..4c2bdbc 100644 --- a/src/zr/zspawn.inc +++ b/src/zr/zspawn.inc @@ -35,6 +35,8 @@ new Handle:tZSpawn = INVALID_HANDLE; */ new Handle:g_hZSpawnSteamIDCache = INVALID_HANDLE; +new bool:g_bZSpawnClientInfected[MAXPLAYERS + 1] = {false, ...}; + /** * Create commands specific to ZSpawn. */ @@ -63,6 +65,9 @@ ZSpawnOnMapStart() // Reset the SteamID cache. SteamidCacheReset(g_hZSpawnSteamIDCache); + + for(new client = 1; client <= MAXPLAYERS; client++) + g_bZSpawnClientInfected[client] = false; } /** @@ -86,6 +91,8 @@ ZSpawnOnClientDisconnect(client) // Add client to the SteamID cache. SteamidCacheAddClient(g_hZSpawnSteamIDCache, client); + + g_bZSpawnClientInfected[client] = false; } /** @@ -99,6 +106,26 @@ ZSpawnOnClientDeath(client) SteamidCacheAddClient(g_hZSpawnSteamIDCache, client); } +/** + * Client has been infected. + * + * @param client The client index. + */ +ZSpawnOnClientInfected(client) +{ + g_bZSpawnClientInfected[client] = true; +} + +/** + * Client was turned back into a human. + * + * @param client The client index. + */ +ZSpawnOnClientHuman(client) +{ + g_bZSpawnClientInfected[client] = false; +} + /** * The round is starting. */ @@ -107,6 +134,9 @@ ZSpawnOnRoundStart() // Reset the SteamID cache. SteamidCacheReset(g_hZSpawnSteamIDCache); + for(new client = 1; client <= MAXPLAYERS; client++) + g_bZSpawnClientInfected[client] = false; + // If zspawn timer is running, then kill it. if (tZSpawn != INVALID_HANDLE) { @@ -246,7 +276,11 @@ bool:ZSpawnClient(client, bool:force = false, bool:zombie = false) } case 0: { - teamzombie = false; + // Client has been infected this round, respawning as a zombie + if(g_bZSpawnClientInfected[client]) + teamzombie = true; + else + teamzombie = false; } case 1: {