Jump to content

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


Go to solution Solved by Ted2,

3 posts in this topic

Recommended Posts

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below. For more information, please read our Posting Guidelines.
Reply to this topic... Posting Guidelines

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
  • 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