Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill hegrenade projectile on team change #87

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/vscripts/ZombieReborn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 0 additions & 14 deletions scripts/vscripts/ZombieReborn/Infect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down