From bd7f406963eec495b367a0e7c9a8bfbbff9de593 Mon Sep 17 00:00:00 2001 From: Connor <34824423+EasterLee@users.noreply.github.com> Date: Thu, 9 Nov 2023 02:30:53 -0500 Subject: [PATCH] Kill hegrenade projectile on team change --- scripts/vscripts/ZombieReborn.lua | 8 ++++++++ scripts/vscripts/ZombieReborn/Infect.lua | 14 -------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/scripts/vscripts/ZombieReborn.lua b/scripts/vscripts/ZombieReborn.lua index c5d2e8d..12ffedb 100644 --- a/scripts/vscripts/ZombieReborn.lua +++ b/scripts/vscripts/ZombieReborn.lua @@ -157,6 +157,14 @@ end function OnPlayerTeam(event) --__DumpScope(0, event) local hPlayer = EHandleToHScript(event.userid_pawn) + + local tThrewnNades = Entities:FindAllByClassname("hegrenade_projectile") + for __, hProjectile in ipairs(tThrewnNades) do + if hProjectile and hProjectile:GetOwner() == hPlayer then + DoEntFireByInstanceHandle(hProjectile, "Kill", "", 0.02, nil, nil) + end + end + if ZR_ZOMBIE_SPAWNED and event.team == CS_TEAM_CT and tCureList[hPlayer] == nil then --SetTeam doesn't work on the same tick as well :pepemeltdown: DoEntFireByInstanceHandle(hPlayer, "runscriptcode", "thisEntity:SetTeam(CS_TEAM_NONE); thisEntity:SetTeam(CS_TEAM_T)", 0.01, nil, nil) diff --git a/scripts/vscripts/ZombieReborn/Infect.lua b/scripts/vscripts/ZombieReborn/Infect.lua index f111698..7f0403f 100644 --- a/scripts/vscripts/ZombieReborn/Infect.lua +++ b/scripts/vscripts/ZombieReborn/Infect.lua @@ -39,13 +39,6 @@ function Infect(hInflictor, hInfected, bKeepPosition, bDead) end end - local tThrewnNades = Entities:FindAllByClassname("hegrenade_projectile") - for __, hProjectile in ipairs(tThrewnNades) do - if hProjectile and hProjectile:GetOwner() == hInfected then - DoEntFireByInstanceHandle(hProjectile, "Kill", "", 0.02, nil, nil) - end - end - DebugPrint("Setting regular zombie class") InjectPlayerClass(PickRandomZombieDefaultClass(), hInfected) @@ -82,13 +75,6 @@ function InfectMotherZombie(hInfected, bKeepPosition) end end - local tThrewnNades = Entities:FindAllByClassname("hegrenade_projectile") - for __, hProjectile in ipairs(tThrewnNades) do - if hProjectile and hProjectile:GetOwner() == hInfected then - DoEntFireByInstanceHandle(hProjectile, "Kill", "", 0.02, nil, nil) - end - end - DebugPrint("Setting mother zombie class") InjectPlayerClass(ZRClass.Zombie.MotherZombie, hInfected)