Help! The function works but the game crashes !

I tried to save it to addpointsBtn to use, it worked but the game crashed immediately. Hope everyone will help !
Screenshot_20240226-222337_MT VIP~2.png

Screenshot_20240226-222341_MT VIP~2.png
 
You need to hook an update function from the class then hook void addPoints(int pointsToAdd) {} through that like this....

C++:
bool AddPoints;


void (*addPoints)(void *instance, int value);


void (*old_Update)(void *instance);
void Update(void *instance) {
    if(instance!=NULL) {
        if(AddPoints) {
            addPoints(instance, 9999);
            AddPoints=false;
        }
    }
    old_Update(instance);
}

   

HOOK("0xOFFSET", Update, old_Update);



case 5:
    AddPoints = !AddPoints;
    break;
 
You need to hook an update function from the class then hook void addPoints(int pointsToAdd) {} through that like this....

C++:
bool AddPoints;


void (*addPoints)(void *instance, int value);


void (*old_Update)(void *instance);
void Update(void *instance) {
    if(instance!=NULL) {
        if(AddPoints) {
            addPoints(instance, 9999);
            AddPoints=false;
        }
    }
    old_Update(instance);
}

  

HOOK("0xOFFSET", Update, old_Update);



case 5:
    AddPoints = !AddPoints;
    break;
That's not what I meant, I want when the game calls that function it will save the void instance pointer to addpointsBtn and I can use it without the game having to call it, I tried it and it seems to work but the game was thrown again. Thank you for your answer <3
 
Back
Top Bottom