From b5ed266941fb4813084903fd72afac14a4f8cf59 Mon Sep 17 00:00:00 2001 From: XeroX Date: Sat, 16 Apr 2022 16:07:16 +0200 Subject: [PATCH] ZPS: Add missing offsets (#1719) * Update offsets for ZPS 3.2 Zombie Panic! Source Version 3.2 released and these are the updated offsets. * Update offsets for 3.2 ZPS 3.2 has been release and these are the updated offsets / signatures. * ZPS: Add missing offsets. Adds support for OnTakeDamage_Alive, GetMaxHealth, Blocked, Reload and GroundEntChanged. I wasn't aware these were missing entirely or I would have pushed them with the previous PR. * ZPS Add missing offsets. Adds support for GivePlayerAmmo. Wasn't aware these were missing the first place. * Fix ForcePlayerSuicide not properly working in ZPS ZPS requires the second bool parameter to be true otherwise it won't do anything for players in the lobby or delayed for players on either team 2 or team 3. * Fixed breaking code for other mods. Added bForce which is set to true for zps. --- extensions/sdktools/vnatives.cpp | 10 ++++++++-- gamedata/sdkhooks.games/game.zpanic.txt | 25 +++++++++++++++++++++++++ gamedata/sdktools.games/game.zpanic.txt | 5 +++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/extensions/sdktools/vnatives.cpp b/extensions/sdktools/vnatives.cpp index be0ce97f..ea66eb31 100644 --- a/extensions/sdktools/vnatives.cpp +++ b/extensions/sdktools/vnatives.cpp @@ -516,13 +516,19 @@ static cell_t ForcePlayerSuicide(IPluginContext *pContext, const cell_t *params) return pContext->ThrowNativeError("\"CommitSuicide\" wrapper failed to initialize"); } } + bool bForce = false; + if (!strcmp(g_pSM->GetGameFolderName(), "zps")) + { + // ZPS requires force to be set as true otherwise the action itself is delayed. + // Which affects Slay and Timebomb. + bForce = true; + } START_CALL(); DECODE_VALVE_PARAM(1, thisinfo, 0); *(bool *)(vptr + pCall->vparams[0].offset) = false; - *(bool *)(vptr + pCall->vparams[1].offset) = false; + *(bool *)(vptr + pCall->vparams[1].offset) = bForce; FINISH_CALL_SIMPLE(NULL); - return 1; } #else diff --git a/gamedata/sdkhooks.games/game.zpanic.txt b/gamedata/sdkhooks.games/game.zpanic.txt index 8a46eded..9fefa4c3 100644 --- a/gamedata/sdkhooks.games/game.zpanic.txt +++ b/gamedata/sdkhooks.games/game.zpanic.txt @@ -4,6 +4,31 @@ { "Offsets" { + "GroundEntChanged" + { + "windows" "188" + "linux" "190" + } + "OnTakeDamage_Alive" + { + "windows" "287" + "linux" "288" + } + "GetMaxHealth" + { + "windows" "126" + "linux" "127" + } + "Blocked" + { + "windows" "109" + "linux" "110" + } + "Reload" + { + "windows" "287" + "linux" "288" + } "EndTouch" { "windows" "107" diff --git a/gamedata/sdktools.games/game.zpanic.txt b/gamedata/sdktools.games/game.zpanic.txt index e141962b..56e949b9 100644 --- a/gamedata/sdktools.games/game.zpanic.txt +++ b/gamedata/sdktools.games/game.zpanic.txt @@ -96,6 +96,11 @@ "windows" "25" "linux" "26" } + "GiveAmmo" + { + "windows" "264" + "linux" "265" + } } "Signatures" {