Jump to content

How to return a value to a method using arithmetic operators?


PixelYT

3 posts in this topic

Recommended Posts

Posted

Let's say I have this method:

private int AmmoAmount(){}; // 0xOFFSET

And I wanted hook it and multiply or add my current ammo amount instead of returning an exact value. How would I do that? Is this how I would do it? Example:

int (*old_AmmoAmount)(void *instance);
int AmmoAmount(void *instance)
{
return old_AmmoAmount(instance) * 10; // Return whatever my current ammo is multiplied by 10
}
return old_AmmoAmount(instance); //Just return exact original value
}
// MSHOOKFUNCTION

Would that work? Basically what I want to do is using arithmetic operators to change my ammo instead of returning an exact value in the hook like we do return 99999;

@Ted2I am sorry for bothering you, but I hope you help me because you are the only one helping people and the android help section is very inactive

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines