From 9c056ed200971472758b310e7a9f51c1204d10f7 Mon Sep 17 00:00:00 2001 From: Altair Sossai Date: Wed, 11 Sep 2024 15:53:55 -0300 Subject: [PATCH] Add l4d2_no_skip_getup_animation plugin and update shared_plugins.cfg --- .../optional/l4d2_no_skip_getup_animation.smx | Bin 0 -> 4018 bytes .../scripting/l4d2_no_skip_getup_animation.sp | 81 ++++++++++++++++++ cfg/cfgogl/zonemod/shared_plugins.cfg | 1 + 3 files changed, 82 insertions(+) create mode 100644 addons/sourcemod/plugins/optional/l4d2_no_skip_getup_animation.smx create mode 100644 addons/sourcemod/scripting/l4d2_no_skip_getup_animation.sp diff --git a/addons/sourcemod/plugins/optional/l4d2_no_skip_getup_animation.smx b/addons/sourcemod/plugins/optional/l4d2_no_skip_getup_animation.smx new file mode 100644 index 0000000000000000000000000000000000000000..30a73e7e6ab429891bd85a8cd01e614559078f4b GIT binary patch literal 4018 zcmZ9H2UJs8yM{w(LKJ3b(v^`SEl5!WDKZEu2nf=V4xuC@QCdQe1?JKeDbf-u}bFA4BsfEGYxl|i5gfDS?73 zU=EOFz$F2e01-S10v+cCfrx;sX@Wq%0jvdL2>1nnEkF_gKj?M?kpn)k2>4H^KPn&) z1P$-tw|F*Eeh+tH}Kga)8|Go)C zMuz=!9)U#%1_Z+X&n`SL;-8&A!Z$qpe=lJnfe2t6G{7$i3JXCTynCRC5ahoaf`p;| zd-(6$e>Z{<|GB^(@W#)d+er*Tit8&}(~MZgb5DD6B*M|KpX zSOv|`JAa=p_dA92|LT!AIO4ZiC|Uq#Ex_~#>noti;Pqm z(FI3)v7v&@BRF^_B=zykW>ZXK%jjv^9;nV75QjK5?~>e2JX*Me~K4r&h-3mkQzOA+48? zXYrMFudY9E>2qzuuD~FipkP*Sz@6qhlPY_ZDJt*Mx#wFP-uapQNssW>W~Nx3c3YTH z>ZO?=A>pl&{n%Y%m>X%o z@S$_JoN5?UXzOWs=9#M|17WTmI<0R~R$Sjt@M3)&jU?WG=J2k@T!KTC&aNx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%_aq;*| z2&UF8ULPa)^+*F~mdlHKt@kkQ29y7~&H5?2FSVTu=H7pJ*=X_iX%%)1(Iw3gZYreF zO9``wk3ZL(zS87hW9TyW(zVe>hdvS#r{PSV2w~&L6X~?zhI(S%svvt*&&y+gYS>4d z7lz@4?;isn8;?EZe!B$WgnFP(hc-o9Eg6f<33S(1lDEn9l+J~b{=!{BwDG`E3a+i^ z!4H$k+i@;`POW}eYLj_-<8$@oD@R)4Y6%arbQ$+fZvk|yJYsITc*l}94Ecm_5lT2G zTf~{u@$M@aZiJyr`ro6-5+-Etx7W{2)ugXHYE1DyZqxBA)pjoQu>PsiUf0Mr7GtCH zZN6@(I%ge{rG`yuW-VoioXmJuxgNa2S&yrjHJ&%K-0oPd9H&D@=ENQ<%i zBpU1N@}1Yb(yye#VXM=$9jQG;^ioM!9y}d5LL=Jwp&VPEez=$ot24h^yxgbREIDcL zp)1vhJJ5m + +#define TEAM_SPECTATOR 1 +#define TEAM_SURVIVOR 2 + +#define DELAY_TIME_IN_SECONDS 5.0 + +float LastDamageReceivedOn[MAXPLAYERS + 1]; + +public Plugin myinfo = +{ + name = "L4D2 - No Skip Getup Animation", + author = "Altair Sossai", + description = "Prevents players from skipping the getup animation", + version = "1.0.0", + url = "https://github.com/SirPlease/L4D2-Competitive-Rework" +}; + +public void OnPluginStart() +{ + AddCommandListener(Spectate_Callback, "sm_spectate"); + AddCommandListener(Spectate_Callback, "sm_spec"); + AddCommandListener(Spectate_Callback, "sm_s"); + AddCommandListener(JoinTeam_Callback, "jointeam"); + + HookEvent("round_start", RoundStart_Event); + HookEvent("player_hurt", PlayerHurt_Event); + + ClearLastDamageReceivedOn(); +} + +Action Spectate_Callback(int client, char[] command, int args) +{ + return CanGoToSpec(client) ? Plugin_Continue : Plugin_Handled; +} + +Action JoinTeam_Callback(int client, char[] command, int args) +{ + if (args == 0) + return Plugin_Continue; + + char buffer[128]; + GetCmdArg(1, buffer, sizeof(buffer)); + + if (StrEqual("Survivors", buffer, false) || StrEqual("2", buffer, false)) + return Plugin_Continue; + + return CanGoToSpec(client) ? Plugin_Continue : Plugin_Handled; +} + +void RoundStart_Event(Handle event, const char[] name, bool dontBroadcast) +{ + ClearLastDamageReceivedOn(); +} + +void PlayerHurt_Event(Event event, const char[] name, bool dontBroadcast) +{ + int client = GetClientOfUserId(GetEventInt(event, "userid")); + + if (client <= 0 || client > MaxClients || !IsClientInGame(client) || GetClientTeam(client) != TEAM_SURVIVOR) + return; + + LastDamageReceivedOn[client] = GetEngineTime(); +} + +void ClearLastDamageReceivedOn() +{ + for (int i = 1; i <= MaxClients; i++) + LastDamageReceivedOn[i] = 0.0; +} + +bool CanGoToSpec(int client) +{ + if (GetClientTeam(client) != TEAM_SURVIVOR) + return true; + + return (GetEngineTime() - LastDamageReceivedOn[client]) >= DELAY_TIME_IN_SECONDS; +} \ No newline at end of file diff --git a/cfg/cfgogl/zonemod/shared_plugins.cfg b/cfg/cfgogl/zonemod/shared_plugins.cfg index 3a6e8d57e..f7e1b5186 100644 --- a/cfg/cfgogl/zonemod/shared_plugins.cfg +++ b/cfg/cfgogl/zonemod/shared_plugins.cfg @@ -167,6 +167,7 @@ sm plugins load optional/l4d2_playstats_sync.smx sm plugins load optional/l4d2_ranking.smx sm plugins load optional/l4d2_show_patent_icon.smx sm plugins load optional/l4d2_localhost.smx +sm plugins load optional/l4d2_no_skip_getup_animation.smx // Letzzzz go. sm plugins load confoglcompmod.smx