Solved How to Hook void in lgl 2.9?

Status
Not open for further replies.

NepMods69

Inactive Approved Modder
Mar 6, 2022
122
5,271
193
Nepal
void (*killPlayer)(void *instance); // Doesn't take any additional parameters

void(*old_LateUpdate)(void *instance);
void LateUpdate(void *instance)
{
if(instance != NULL)
{
bool IsEnemy = *(bool*)((uint64_t)instance + 0x8C) // Declare a variable to isEnemy to access it
if(IsEnemy) // Check if it's enemies
{
killPlayer(instance); // And if they are then kill them
}
}
old_LateUpdate(instance); If they aren't enemies then return original value
}
MsHookFunction((void*)getAbsoluteAddress(0x32720AB), (void*)LateUpdate, (void**)&old_LateUpdate);

killPlayer = (void (*)(void *))getAbsoluteAddress(targetLibName, 0x2485B9);
 
Status
Not open for further replies.