LongBeardedLion Expert Cheater
Reputation: 0
Joined: 10 Apr 2020 Posts: 174
|
Posted: Fri Nov 07, 2025 4:56 pm Post subject: Why does my hack crash? Calling game functions. |
|
|
So its really hard to find what im doing wrong.
Im doing an automation hack, where my units shoot and run for an RTS.
Its really cool.
But sometimes and for no apparent reason the game crashes, especially if there is lag.
The sad thing is that it works 90% of the times.
So its hard to even tell what is going on.
At first i thought it must be the units im sending to the function are no longer alive, or valid (could be dead).
So i made a function that checks the health of the unit, as well as the ID, to make sure the unit is valid.
But it still crashed.
I then started speculating it must be something unconventional. So i looked for what it looks like the game loop using x32dbg.
Detoured the function and call my movement function from inside that game loop. Kind of weird.
But this never crashes. Never.
But on the other hand it lags like crazy on bigger games.
So I realized this is something beyond my technical knowledge, and wonder if anyone can help me with this? Or suggest what could possibly be the problem...
Im calling the game functions this way:
| Code: | struct _moveUnitsTarget2
{
typedef void(__thiscall* _moveUnits2)(void* pThis, int a2, int a3, int a4, float a5, float a6);
_moveUnits2 moveUnits2;
//its the same as _moveUnitsTarget but with floats
}moveUnitsTarget2;
if (moveUnitsTarget2.moveUnits2 == nullptr)
moveUnitsTarget2.moveUnits2 = (_moveUnitsTarget2::_moveUnits2)(baseGlobal + 0x3D830);
moveUnitsTarget2.moveUnits2(ECX2, reinterpret_cast<int>(&curUnit), 1, 0x0, curSquad->SquadCheckpoints[0].X, curSquad->SquadCheckpoints[0].Y); |
|
|
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25813 Location: The netherlands
|
Posted: Sat Nov 08, 2025 4:31 am Post subject: |
|
|
Maybe the character has died after you checked it was alive (can happen between 2 cpu instructions on multithreaded games)
Alternatively, it may be a threading issue, and calling moveUnits2 at the same time as another function can cause an issue (e.g when a character dies and it's memory is being deleted)
It's best to have it inside the main the game loop thread. Just add some code so it doesn't execute every single time (e.g keep a timestamp of the last execution and only every half a second call your code)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|