Question about hotkey
Sorry for another stupid question, but i spend a long time to make a hotkey for noreload feature.
When i try to launch the game it crash with send error report. WTF?
When i try to comment this two strings:
//*(float*)((*(DWORD*)((*(DWORD*)(CShell+WeaponMgr)) +(4*i))) + NoReload) = 100.0f;
//*(float*)((*(DWORD*)((*(DWORD*)(CShell+WeaponMgr)) +(4*i))) + NoReload) = 0.0f;
the game is work correct and when i press F7 button messagebox are displayed, and everything is good.
So errors in this 2 strings.
How i can make noreload on and off without game crashing?
Please help.
Here is the full code:
When i try to launch the game it crash with send error report. WTF?
When i try to comment this two strings:
//*(float*)((*(DWORD*)((*(DWORD*)(CShell+WeaponMgr)) +(4*i))) + NoReload) = 100.0f;
//*(float*)((*(DWORD*)((*(DWORD*)(CShell+WeaponMgr)) +(4*i))) + NoReload) = 0.0f;
the game is work correct and when i press F7 button messagebox are displayed, and everything is good.
So errors in this 2 strings.
How i can make noreload on and off without game crashing?
Please help.
Here is the full code:
Code:
#include <windows.h>
#pragma comment(linker, "/MERGE:.rdata=.text")
#pragma comment(linker, "/FILEALIGN:512 /SECTION:.text,EWRX /IGNORE:4078")
#pragma comment(linker, "/BASE:0x13110000")
#pragma comment(linker, "/ENTRY:New_DllMain")
#define WeaponMgr 0xA68F90
#define NoReload 0x269C
bool bNoReload = false;
//---
DWORD WINAPI H4X(LPVOID)
{
while (true)
{
DWORD CShell = (DWORD)GetModuleHandleA("CShell.dll");
DWORD pWeaponMgr = *(DWORD*)(CShell+WeaponMgr);
if ( GetAsyncKeyState(VK_F7) != false )
{
MessageBox(0,0,0,0);
bNoReload = !bNoReload;
}
if ( pWeaponMgr )
{
for ( int i = 0; i < 559; i++ )
{
if ( bNoReload ) {
*(float*)((*(DWORD*)((*(DWORD*)(CShell+WeaponMgr)) +(4*i))) + NoReload) = 100.0f;
}
else {
*(float*)((*(DWORD*)((*(DWORD*)(CShell+WeaponMgr)) +(4*i))) + NoReload) = 0.0f;
}
}
}
Sleep(300);
}
}
//---
bool R2H()
{
if ( GetModuleHandleA("CShell.dll") != NULL && GetModuleHandleA("ClientFx.fxd") != NULL )
return 1;
return 0;
}
//---
DWORD WINAPI W41t(LPVOID)
{
while ( !R2H()) Sleep(200);
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)H4X, NULL, NULL, NULL);
return 0;
}
//---
void New_DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved)
{
DisableThreadLibraryCalls(hDll);
if ( dwReason == DLL_PROCESS_ATTACH )
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)W41t, 0, 0, 0);
}