This is the AMP version of this page.
If you want to load the real page instead, click this text.

Help! LGL MOD MENU - how to insert slidervalue using a pointer? 0xC0

CHEATS GAMES

Solid & Active Platinian
hope someone helps, i'm new to game hacking


i have a game that i can cut speed using buttons but how would i do that to change speed using slider

C++:
void (*orig_Update) (void* instance);
void Update(void* instance) {
    if (instance != NULL && sliderValue > 1) {

        *(float*)((uint64_t)instance + 0xC0);
        *(float*)((uint64_t)instance + 0xBC);

    }
    return orig_Update(instance);
}


C++:
 MSHookFunction((void *) getAbsoluteAddress(targetLibName, string2Offset(OBFUSCATE_KEY("0x556A90", '?'))), (void *) Update, (void **) &orig_Update);


C++:
  case 1:
            if (value >= 1) {
                sliderValue = value;
            }
            break;
 
C++:
if (instance != NULL && sliderValue > 1) {
   *(float*)((uint64_t)instance + 0xC0) = sliderValue;
   *(float*)((uint64_t)instance + 0xBC) = sliderValue;
}

Note! You are assigning the int type to the variable in the field that you hooked up with the float type. You can do this because C++ will convert sliderValue to float for you. If this were done to an int variable of the float type, then the variable would simply be rounded up to an integer.
Example:
int intVar = 0;
float floatVar = 3.25f;
intVar = floatVar;
intVar would equal 3 since the fractional part was dropped.



It is better to remove unnecessary check in switch. Since you already have a check in Update and it can act as the main one:

if (instance != NULL && sliderValue > 1) {
// action
}

case 1:
sliderValue = value;
break;


Before you ask anything, try to at least read the documentation... You were shown examples of hooks in the menu.
 
Last edited:


it worked, I had tried this way before but it didn't work on LGL modmenu 3.2, there is a problem in this modmenu version, I add other cheats with a button and it doesn't work, I put it on version 2.9 that I always use and it worked perfectly.. thanks.
 

Everything works fine for me on 3.2, I checked RadioButton, Button, Toggle, SeekBar, InputText, InputValue