Hey, it's me again, for trying to learn something but not able to because my hooking seems not working (i'm probably bad af at C++ ngl)
Here is my code:
// Define and initialize damagemultiplier
bool damagemultiplier = true; // or false, depending on your requirement
// ...
//the void *instance is a self-created variable.
double (*old_GetWeaponAttack)(void *instance);
double GetWeaponAttack(void *instance) {
// Check if instance is NULL to prevent CRASH
if (instance != NULL) {
if (damagemultiplier) { // If damagemultiplier is true
double originalAttack = old_GetWeaponAttack(instance); // Get the original attack value
// Multiply the original attack value by 2
return originalAttack * 2; // Return the modified value
}
// Return the original value
return old_GetWeaponAttack(instance);
}
}
Can someone tell me what i'm doing wrong here?
I'm trying to hook GetWeaponAttack and multiply the base atk by 2


Here is my code:
// Define and initialize damagemultiplier
bool damagemultiplier = true; // or false, depending on your requirement
// ...
//the void *instance is a self-created variable.
double (*old_GetWeaponAttack)(void *instance);
double GetWeaponAttack(void *instance) {
// Check if instance is NULL to prevent CRASH
if (instance != NULL) {
if (damagemultiplier) { // If damagemultiplier is true
double originalAttack = old_GetWeaponAttack(instance); // Get the original attack value
// Multiply the original attack value by 2
return originalAttack * 2; // Return the modified value
}
// Return the original value
return old_GetWeaponAttack(instance);
}
}
Can someone tell me what i'm doing wrong here?

I'm trying to hook GetWeaponAttack and multiply the base atk by 2

