Skip to content
Guest Big Announcement

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

Featured Replies

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.

Featured Content

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.