6
6
7
7
#include < rapidjson/document.h>
8
8
9
- AUTOHOOK_INIT ()
10
-
11
- // clang-format off
12
- AUTOHOOK(CHudChat__AddGameLine, client.dll + 0x22E580 ,
13
- void , __fastcall, (void * self, const char * message, int inboxId, bool isTeam, bool isDead))
14
- // clang-format on
9
+ static void (__fastcall* o_pCHudChat__AddGameLine)(void * self, const char * message, int inboxId, bool isTeam, bool isDead) = nullptr;
10
+ static void __fastcall h_CHudChat__AddGameLine (void * self, const char * message, int inboxId, bool isTeam, bool isDead)
15
11
{
16
12
// This hook is called for each HUD, but we only want our logic to run once.
17
13
if (self != *CHudChat::allHuds)
@@ -36,7 +32,7 @@ void, __fastcall, (void* self, const char* message, int inboxId, bool isTeam, bo
36
32
" CHudChat_ProcessMessageStartThread" , static_cast <int >(senderId) - 1 , payload, isTeam, isDead, type);
37
33
if (result == SQRESULT_ERROR)
38
34
for (CHudChat* hud = *CHudChat::allHuds; hud != NULL ; hud = hud->next )
39
- CHudChat__AddGameLine (hud, message, inboxId, isTeam, isDead);
35
+ o_pCHudChat__AddGameLine (hud, message, inboxId, isTeam, isDead);
40
36
}
41
37
42
38
ADD_SQFUNC (" void" , NSChatWrite, " int context, string text" , " " , ScriptContext::CLIENT)
@@ -68,5 +64,6 @@ ADD_SQFUNC("void", NSChatWriteLine, "int context, string text", "", ScriptContex
68
64
69
65
ON_DLL_LOAD_CLIENT (" client.dll" , ClientChatHooks, (CModule module))
70
66
{
71
- AUTOHOOK_DISPATCH ()
67
+ o_pCHudChat__AddGameLine = module.Offset (0x22E580 ).RCast <decltype (o_pCHudChat__AddGameLine)>();
68
+ HookAttach (&(PVOID&)o_pCHudChat__AddGameLine, (PVOID)h_CHudChat__AddGameLine);
72
69
}
0 commit comments