Solved Help

Status
Not open for further replies.

Master TK

Platinian
Original poster
Nov 11, 2019
30
7
8
26
Brasil
why doesn't the value go back to original when the slide is at 0?

float Jump = 4.5;

float (*old_jump)(void *instance);
float jump(void *instance) {
if (instance != NULL && Jump) {
return (float) Jump;
}
return Jump(instance);

}

HOOK("0x46D7DC", jump, old_jump);

OBFUSCATE("12_CollapseAdd_SeekBar_JUMP_0_25"),

case 12:
Jump = (float) value;
break;
 

Francois284Modz

Awesome Active Platinian
Jun 10, 2018
188
2,445
193
26
france
Becuse you never check if jump is bigger then 0

Replace in your hook

C++:
If(jump > 0)
{
return (float)jump;
}
 

Master TK

Platinian
Original poster
Nov 11, 2019
30
7
8
26
Brasil
You are returning the return value from a "Jump" function which does not even exist. I don't know how the compiler even allows that. The original value is retrieved by the old_jump function
Jump = 4.5;...but ok, please help me... how do I make when the slide bar (seekbar) is at 0 be modified to a specific value? example sildebar(seekbar) 0 = value is 4.5f.. PLEASE HELP ME
 

DigitalKnight

Approved Modder
Approved Modder
Jul 31, 2018
185
11,374
1,193
23
Within the Heart
Jump = 4.5;...but ok, please help me... how do I make when the slide bar (seekbar) is at 0 be modified to a specific value? example sildebar(seekbar) 0 = value is 4.5f.. PLEASE HELP ME
That's what i am telling you. Jump is not a function. You cannot invoke it with (), it's a float variable. You should learn the basics of programming first before trying to hook. Otherwise you will keep copy pasting people's codes instead of creating your own
 

SamiMalik6969

Rookie
Aug 23, 2022
2
1
3
21
Pakistan
Jump = 4.5;...but ok, please help me... how do I make when the slide bar (seekbar) is at 0 be modified to a specific value? example sildebar(seekbar) 0 = value is 4.5f.. PLEASE HELP ME
Your value is returning from "Jump" as the modder already explained to you and you set the Jump to 4.5f, so if you want to return it to original, just do
float Jump;
 

SamiMalik6969

Rookie
Aug 23, 2022
2
1
3
21
Pakistan
Jump = 4.5;...but ok, please help me... how do I make when the slide bar (seekbar) is at 0 be modified to a specific value? example sildebar(seekbar) 0 = value is 4.5f.. PLEASE HELP ME

Code:
float Jump;

float (*old_jump)(void *instance);
float jump(void *instance) {
if (instance != NULL && Jump) {
return (float) Jump;
}
return old_jump(instance);

}
 
  • Like
Reactions: Master TK

Master TK

Platinian
Original poster
Nov 11, 2019
30
7
8
26
Brasil
Code:
float Jump;

float (*old_jump)(void *instance);
float jump(void *instance) {
if (instance != NULL && Jump) {
return (float) Jump;
}
return old_jump(instance);

}
I've tried this but it doesn't return to the initial value, the value goes to 0...
 

DigitalKnight

Approved Modder
Approved Modder
Jul 31, 2018
185
11,374
1,193
23
Within the Heart
I've tried this but it doesn't return to the initial value, the value goes to 0...
Here is the code you want
C++:
float Jump = 0;
float (*old_jump)(void* instance);
float jump(void* instance){
 if(instance != NULL && Jump > 0){
     return Jump;
  }
  return 4.5;
}
Again, you should learn cpp and programming in general otherwise you won't be able to truly ever create your own mods. Ciao :)
 
  • Like
Reactions: SamiMalik6969
Status
Not open for further replies.