From a5e0f31fc1cf3df640c536747ead28701568acac Mon Sep 17 00:00:00 2001 From: BotoX Date: Mon, 30 Dec 2019 14:19:05 +0100 Subject: [PATCH] Add teleport on infect option. --- src/zr/cvars.inc | 2 ++ src/zr/infect.inc | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/zr/cvars.inc b/src/zr/cvars.inc index d65540f..f5432d3 100644 --- a/src/zr/cvars.inc +++ b/src/zr/cvars.inc @@ -107,6 +107,7 @@ enum CvarsList Handle:CVAR_INFECT_WEAPONS_DROP, Handle:CVAR_INFECT_KNIFE_COOLDOWN, Handle:CVAR_INFECT_MAX_DISTANCE, + Handle:CVAR_INFECT_TELEPORT, Handle:CVAR_INFECT_MZOMBIE_MODE, Handle:CVAR_INFECT_MZOMBIE_RATIO, Handle:CVAR_INFECT_MZOMBIE_MIN, @@ -337,6 +338,7 @@ CvarsCreate() g_hCvarsList[CVAR_INFECT_WEAPONS_DROP] = CreateConVar("zr_infect_weapons_drop", "1", "Force player to drop all weapons on infect, disabling this will strip weapons instead."); g_hCvarsList[CVAR_INFECT_KNIFE_COOLDOWN] = CreateConVar("zr_infect_knife_cooldown", "1.0", "Time in seconds during which knife can not be used after becoming a zombie."); g_hCvarsList[CVAR_INFECT_MAX_DISTANCE] = CreateConVar("zr_infect_max_distance", "80.0", "The maximum allowed distance between a client and an attacker for a successful infection. [0.0 = Disabled]"); + g_hCvarsList[CVAR_INFECT_TELEPORT] = CreateConVar("zr_infect_teleport", "0", "Teleports on infect to zombie."); // Effects g_hCvarsList[CVAR_INFECT_EXPLOSION] = CreateConVar("zr_infect_explosion", "1", "Disabling this will disable the fireball, smoke cloud, and sparks in a more efficient way."); diff --git a/src/zr/infect.inc b/src/zr/infect.inc index e3cb233..83dc761 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -819,10 +819,20 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa // Check override. else { + new bool:teleport = GetConVarBool(g_hCvarsList[CVAR_INFECT_TELEPORT]); if (respawnoverride && respawn) { ZTele_TeleportClient(client); } + // Teleport to attacker when infected + else if(teleport && ZRIsClientValid(attacker)) + { + // Get client's position. + new Float:clientloc[3]; + GetClientAbsOrigin(attacker, clientloc); + + TeleportEntity(client, clientloc, NULL_VECTOR, NULL_VECTOR); + } } // Remove kevlar and helmet