Help! The function works but the game crashes !

danganhtuan12003

Platinian
Original poster
Oct 25, 2020
14
1
3
VietNam
Nó là gì :face09: bool, int, float, void, field offset..bạn muốn nối chức năng gì tiền, vàng, sức khỏe?....
Nó đây : // RVA: 0x769774 Offset: 0x769774 VA: 0x769774
public void addPoints(int pointsToAdd) { }
Tui muốn lưu nó và mỗi khi tui ấn vào nút menu thì nó cộng tiền :>
 

libModz

Awesome Active Platinian
Jun 2, 2022
167
29
28
UK
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;
 

danganhtuan12003

Platinian
Original poster
Oct 25, 2020
14
1
3
VietNam
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