A example that using this method to hook when a player timed out or dropped while he's trying to connect to server
console print like this:
Code:
PlayerA timed out
PlayerB dropped
here is the function in swds.dll
sub_1D4EFF0("%s timed out\n", _ESI + 19720);
Code:
.text:01D9B036 push eax ; Args
.text:01D9B037 push offset aSTimedOut ; "%s timed out\n"
.text:01D9B03C call sub_1D4EFF0
the imagebase of swds.dll is
Code:
.text:01D01000 ; Imagebase : 1D00000
so offset where need to patch is
Code:
01D9B03C + 1 - 1D00000 = 9B03D
so final code
Code:
void C_Client_TimedOut(const char *szMsg, const char *szName)
{
here player timed out hooked
}
void C_Client_Dropped(const char *szMsg, const char *szName)
{
here player dropped hooked
}
void Meta_Attach()
{
//hook Client timed out
write_func(C_Client_TimedOut, GETREALADDR(0x9B03D));
//hook Client dropped
write_func(C_Client_Dropped, GETREALADDR(0x9FF94));
}
Hint:
GETREALADDR is a macro I used,
gamemod = mpbase + offset
serverdll = swdsbase + offset
or you can do signature scan to get the real addr
"write_func" can found above
__________________