Skip to content

Commit

Permalink
Delay SI suicide in 1v1 to prevent issues (#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
jensewe committed Sep 19, 2024
1 parent d398748 commit 74bece6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
Binary file modified addons/sourcemod/plugins/optional/1v1.smx
Binary file not shown.
23 changes: 20 additions & 3 deletions addons/sourcemod/scripting/1v1.sp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Plugin myinfo =
name = "1v1 EQ",
author = "Blade + Confogl Team, Tabun, Visor",
description = "A plugin designed to support 1v1.",
version = "0.2.1",
version = "0.2.2",
url = "https://github.com/SirPlease/L4D2-Competitive-Rework"
};

Expand All @@ -54,7 +54,8 @@ void Event_PlayerHurt(Event hEvent, const char[] sEventName, bool bDontBroadcast
return;
}

int iAttacker = GetClientOfUserId(hEvent.GetInt("attacker"));
int iAttackerId = hEvent.GetInt("attacker");
int iAttacker = GetClientOfUserId(iAttackerId);
if (!IsClientAndInGame(iAttacker) || GetClientTeam(iAttacker) != L4D2Team_Infected) {
return;
}
Expand Down Expand Up @@ -84,13 +85,29 @@ void Event_PlayerHurt(Event hEvent, const char[] sEventName, bool bDontBroadcast

CPrintToChatAll("%t %t", "Tag", "HealthRemaining", sName, L4D2_InfectedNames[iZclass], iRemainingHealth);

ForcePlayerSuicide(iAttacker);
RequestFrame(NextFrame_PlayerHurt, iAttackerId);

if (iRemainingHealth == 1) {
CPrintToChat(iVictim, "%t", "UMad");
}
}

void NextFrame_PlayerHurt(int userid)
{
int iAttacker = GetClientOfUserId(userid);
if (!IsClientAndInGame(iAttacker) || GetClientTeam(iAttacker) != L4D2Team_Infected || !IsPlayerAlive(iAttacker)) {
return;
}

int iZclass = GetEntProp(iAttacker, Prop_Send, "m_zombieClass");

if (iZclass < L4D2Infected_Smoker || iZclass > L4D2Infected_Charger) {
return;
}

ForcePlayerSuicide(iAttacker);
}

bool IsClientAndInGame(int iClient)
{
return (iClient > 0 && IsClientInGame(iClient));
Expand Down

0 comments on commit 74bece6

Please sign in to comment.