Help! Hook help lgl 3.2

Please help write a working hook to set "value" to false, i've tried using the hooking examples given in the menu but it crashes when I took hook on.

[CompilerGenerated]
// RVA: 0x2BAE08C Offset: 0x2BAF08C VA: 0x2BAE08C
private static void set_EnemyCanShoot(bool value) { }
 
It's a void function, you can't return a value to it. You must call it through an Update (preferably from the same class as the EnemyCanShoot method)

First you hook it and create an update hook like this...


void (*set_EnemyCanShoot)(void *instance, bool value);
void (*old_Update)(void *instance);
void Update(void *instance) {
if(instance!=nullptr) {
set_EnemyCanShoot(instance, true);
}
old_Gun_Update(instance);
}


Then under hackthread...


HOOK("0xOFFSET", Update, old_Update);

set_EnemyCanShoot = (void(*)(void*, bool)) getAbsoluteAddress(targetLibName, 0xOFFSSET);
 
It's a void function, you can't return a value to it. You must call it through an Update (preferably from the same class as the EnemyCanShoot method)

First you hook it and create an update hook like this...


void (*set_EnemyCanShoot)(void *instance, bool value);
void (*old_Update)(void *instance);
void Update(void *instance) {
if(instance!=nullptr) {
set_EnemyCanShoot(instance, true);
}
old_Gun_Update(instance);
}


Then under hackthread...


HOOK("0xOFFSET", Update, old_Update);

set_EnemyCanShoot = (void(*)(void*, bool)) getAbsoluteAddress(targetLibName, 0xOFFSSET);
its a static, you dont need instance...
 
C++:
void (*old_set_EnemyCanShoot)(bool);
void set_EnemyCanShoot(bool value) {
    value = false;
    set_EnemyCanShoot(value);
}

or

C++:
void (*set_EnemyCanShoot)(bool);

void (*old_Update)(void *);
void Update(void *instance) {
    set_EnemyCanShoot(false);
    old_Update(instance);
}
 
Back
Top Bottom