@@ -111,6 +111,7 @@ SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, CPlayerSlo
111111SH_DECL_HOOK3_void (ICvar, DispatchConCommand, SH_NOATTRIB, 0 , ConCommandHandle, const CCommandContext&, const CCommand&);
112112SH_DECL_MANUALHOOK1_void (CGamePlayerEquipUse, 0 , 0 , 0 , InputData_t*);
113113SH_DECL_MANUALHOOK2_void (CreateWorkshopMapGroup, 0 , 0 , 0 , const char *, const CUtlStringList&);
114+ SH_DECL_MANUALHOOK2_void (OnTakeDamage_Alive, 0 , 0 , 0 , CTakeDamageInfo*, void *);
114115
115116CS2Fixes g_CS2Fixes;
116117
@@ -129,6 +130,7 @@ CCSGameRules *g_pGameRules = nullptr;
129130IGameTypes* g_pGameTypes = nullptr ;
130131int g_iCGamePlayerEquipUseId = -1 ;
131132int g_iCreateWorkshopMapGroupId = -1 ;
133+ int g_iOnTakeDamageAliveId = -1 ;
132134
133135CGameEntitySystem *GameEntitySystem ()
134136{
@@ -223,26 +225,44 @@ bool CS2Fixes::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool
223225 if (!InitGameSystems ())
224226 bRequiredInitLoaded = false ;
225227
226- if (!bRequiredInitLoaded)
227- {
228- snprintf (error, maxlen, " One or more address lookups, patches or detours failed, please refer to startup logs for more information" );
229- return false ;
230- }
231-
232228 const auto pCGamePlayerEquipVTable = modules::server->FindVirtualTable (" CGamePlayerEquip" );
233229 if (!pCGamePlayerEquipVTable)
234230 {
235231 snprintf (error, maxlen, " Failed to find CGamePlayerEquip vtable\n " );
236- return false ;
232+ bRequiredInitLoaded = false ;
237233 }
238- if (g_GameConfig->GetOffset (" CBaseEntity::Use" ) == -1 )
234+
235+ offset = g_GameConfig->GetOffset (" CBaseEntity::Use" );
236+ if (offset == -1 )
239237 {
240238 snprintf (error, maxlen, " Failed to find CBaseEntity::Use\n " );
241- return false ;
239+ bRequiredInitLoaded = false ;
242240 }
243- SH_MANUALHOOK_RECONFIGURE (CGamePlayerEquipUse, g_GameConfig-> GetOffset ( " CBaseEntity::Use " ) , 0 , 0 );
241+ SH_MANUALHOOK_RECONFIGURE (CGamePlayerEquipUse, offset , 0 , 0 );
244242 g_iCGamePlayerEquipUseId = SH_ADD_MANUALDVPHOOK (CGamePlayerEquipUse, pCGamePlayerEquipVTable, SH_MEMBER (this , &CS2Fixes::Hook_CGamePlayerEquipUse), false );
245243
244+ const auto pCCSPlayerPawnVTable = modules::server->FindVirtualTable (" CCSPlayerPawn" );
245+ if (!pCCSPlayerPawnVTable)
246+ {
247+ snprintf (error, maxlen, " Failed to find CCSPlayerPawn vtable\n " );
248+ bRequiredInitLoaded = false ;
249+ }
250+
251+ offset = g_GameConfig->GetOffset (" CBasePlayerPawn::OnTakeDamage_Alive" );
252+ if (offset == -1 )
253+ {
254+ snprintf (error, maxlen, " Failed to find CBasePlayerPawn::OnTakeDamage_Alive\n " );
255+ bRequiredInitLoaded = false ;
256+ }
257+ SH_MANUALHOOK_RECONFIGURE (OnTakeDamage_Alive, offset, 0 , 0 );
258+ g_iOnTakeDamageAliveId = SH_ADD_MANUALDVPHOOK (OnTakeDamage_Alive, pCCSPlayerPawnVTable, SH_MEMBER (this , &CS2Fixes::Hook_OnTakeDamage_Alive), false );
259+
260+ if (!bRequiredInitLoaded)
261+ {
262+ snprintf (error, maxlen, " One or more address lookups, patches or detours failed, please refer to startup logs for more information" );
263+ return false ;
264+ }
265+
246266 Message ( " All hooks started!\n " );
247267
248268 UnlockConVars ();
@@ -289,6 +309,8 @@ bool CS2Fixes::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool
289309
290310 srand (time (0 ));
291311
312+ Message (" Plugin successfully started!\n " );
313+
292314 return true ;
293315}
294316
@@ -310,6 +332,7 @@ bool CS2Fixes::Unload(char *error, size_t maxlen)
310332 SH_REMOVE_HOOK (ISource2GameEntities, CheckTransmit, g_pSource2GameEntities, SH_MEMBER (this , &CS2Fixes::Hook_CheckTransmit), true );
311333 SH_REMOVE_HOOK (ICvar, DispatchConCommand, g_pCVar, SH_MEMBER (this , &CS2Fixes::Hook_DispatchConCommand), false );
312334 SH_REMOVE_HOOK_ID (g_iCreateWorkshopMapGroupId);
335+ SH_REMOVE_HOOK_ID (g_iOnTakeDamageAliveId);
313336
314337 ConVar_Unregister ();
315338
@@ -809,6 +832,13 @@ void CS2Fixes::Hook_CreateWorkshopMapGroup(const char* name, const CUtlStringLis
809832 RETURN_META (MRES_IGNORED);
810833}
811834
835+ void CS2Fixes::Hook_OnTakeDamage_Alive (CTakeDamageInfo *pInfo, void *a3)
836+ {
837+ CCSPlayerPawn *pPawn = META_IFACEPTR (CCSPlayerPawn);
838+
839+ RETURN_META (MRES_IGNORED);
840+ }
841+
812842void CS2Fixes::OnLevelInit ( char const *pMapName,
813843 char const *pMapEntities,
814844 char const *pOldLevel,
0 commit comments