hook.h is the Header of my own Hooking class but you
can just use Microsoft Detours instead ( its very very similar
to my Code ). For a MS Detours Tutorial take a look here:
[Only registered and activated users can see links. Click Here To Register...]
With this way you can also change Runspeed, Range,
Skillspeed and much more. This is just a small example,
allthough i did not try this Code it should work perfectly
fine. With this way you dont need any Offsets / Baseaddresses
only the function strings for GetProcAddress, you can find
those with OllyDBG 2.0 and IDA.
If you have any Questions, feel free to ask.
can just use Microsoft Detours instead ( its very very similar
to my Code ). For a MS Detours Tutorial take a look here:
[Only registered and activated users can see links. Click Here To Register...]
With this way you can also change Runspeed, Range,
Skillspeed and much more. This is just a small example,
allthough i did not try this Code it should work perfectly
fine. With this way you dont need any Offsets / Baseaddresses
only the function strings for GetProcAddress, you can find
those with OllyDBG 2.0 and IDA.
If you have any Questions, feel free to ask.
Code:
#include <windows.h>
#include "hook.h"
Hook * Attackspeedhook = NULL;
DWORD WINAPI hookthread( LPVOID Param );
char __fastcall myGetAttackSpeed( void* this, DWORD unusededx );
typedef char (__thiscall* CPlayer_GetAttackSpeed )( void* ecx );
CPlayer_GetAttackSpeed oGetAttackSpeed = NULL;
BOOL WINAPI DllMain( HMODULE hModule, DWORD reason, LPVOID lpReserved )
{
UNREFERENCED_PARAMETER(lpReserved);
if (reason == DLL_PROCESS_ATTACH)
{
DisableThreadLibraryCalls(hModule);
CreateThread(NULL, NULL, hookthread, NULL, NULL, NULL);
return 1;
}
else if (reason == DLL_PROCESS_DETACH)
{
Attackspeedhook->RemoveHook();
return 0;
}
return 0;
}
char __fastcall myGetAttackSpeed( void * ecx, DWORD unusededx )
{
return 5; // Attackspeed Value
}
DWORD WINAPI hookthread( LPVOID Param )
{
HMODULE hmod = 0;
while(!hmod)
{
hmod = GetModuleHandle("entitiesmp");
Sleep(50);
}
unsigned long GetAttackspeedadr = reinterpret_cast<unsigned long>( GetProcAddress( hmod, "?GetAttackspeed@CPlayer@@UAECXZ" ));
if( GetAttackspeedadr )
{
Attackspeedhook= new Hook( GetAttackspeedadr , 5, (DWORD)myGetAttackSpeed);
oGetAttackSpeed = (CPlayer_GetAttackSpeed)Attackspeedhook->HookFunc();
}
return 0;
}