Jump to content

I wrote the hooking code and compiled it, but an error occurred and it did not work.


8 posts in this topic

Recommended Posts

Posted

https://workupload.com/file/L3hPuz3ax6F

If you go to the link above, you can see a screenshot of the error.

The code I wrote is below

For reference, the mod template I use is Ted2.

 

public float AttackSpeed

[Token(Token = "0x6001A53")]
                [Address(RVA = "0x17AAA40", Offset = "0x17AAA40", VA = "0x17AAA40")]

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

float(*old_AttackSpeed)(void *Player);
float AttackSpeed(void *Player) {
  if([switches isSwitchOn:@"SpeedHack"]) {
    return old_AttackSpeed * [[switches getValueFromSwitch:@"SpeedHack"] floatValue];
  } // Note I'm closing the if statement here!!!!!!!!!!!!!
  return old_AttackSpeed(Player);
}

void setup() {

  //public int GetGhostMaxSpeed(); // RVA: 0x18DFFF4 Offset: 0x18DFFF4
  HOOK(0x17AAA40, GetAttackSpeed, old_AttackSpeed);


  // Slider Switch - used in hooking
  [switches addSliderSwitch:@"AttackSpeedHack"
              description:@"AttackSpeed Hack"
                minimumValue:0.5
                  maximumValue:100
                    sliderColor:UIColorFromHex(0xBD0000)];

}

void setupMenu() {

Posted

Function definition not allowed here!
You have defined setupMenu twice, also AttackSpeed  then GetAttackSpeed ? 
you need to paste everything here, there is a lot of errors.

You may find useful topics here

Posted

public float AttackSpeed - is variable of type float
float AttackSpeed(void *Player) {} - is a function that return float value

u need to learn something before....

Posted
On 2/3/2024 at 7:52 PM, X204 said:

Function definition not allowed here!
You have defined setupMenu twice, also AttackSpeed  then GetAttackSpeed ? 
you need to paste everything here, there is a lot of errors.

You may find useful topics here

I searched here, saw the function hooking code, and followed it exactly. However, it gave me a headache because it was an error.

Posted
18 hours ago, Saitama said:

public float AttackSpeed - is variable of type float
float AttackSpeed(void *Player) {} - is a function that return float value

u need to learn something before....

Yes, I'm also frustrated, so I'm thinking about studying C language now.

Posted
52 minutes ago, KaiszS22 said:

Yes, I'm also frustrated, so I'm thinking about studying C language now.

easy to start from c# because of unity games are made on c# and u will much more easier understand whats going on inside of game
and then learn only things that u need from c || c++

Posted
17 minutes ago, Saitama said:

easy to start from c# because of unity games are made on c# and u will much more easier understand whats going on inside of game
and then learn only things that u need from c || c++

Oh, I'll learn C# first.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • 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