```
bool isCash = false;
void* CashInstance = nullptr;
void (*old_ctor)(void* instance);
void ctor(void* instance) {
CashInstance = instance;
old_ctor(instance);
}
//void (*addcash)(void *, int amount);
void (*old_Update)(void* instance);
void Update(void* instance) {
if (instance && isCash && CashInstance != nullptr){
*(int*)((uintptr_t)CashInstance + 0x18) = 99999;
}
old_Update(instance);
}
...
HOOK_LIB("libil2cpp.so", "0x91DAB0", ctor, old_ctor);
HOOK_LIB("libil2cpp.so", "0x91502C", Update, old_Update);
```
When I turn on the function, nothing happens. When I used "instance" instead of "cashinstance," I got an error and crash. When I tried to use "cashinstance" without checking for nullptr, I got a "null pointer dereference".
What am I doing wrong? Why is my cashinstance still null?
bool isCash = false;
void* CashInstance = nullptr;
void (*old_ctor)(void* instance);
void ctor(void* instance) {
CashInstance = instance;
old_ctor(instance);
}
//void (*addcash)(void *, int amount);
void (*old_Update)(void* instance);
void Update(void* instance) {
if (instance && isCash && CashInstance != nullptr){
*(int*)((uintptr_t)CashInstance + 0x18) = 99999;
}
old_Update(instance);
}
...
HOOK_LIB("libil2cpp.so", "0x91DAB0", ctor, old_ctor);
HOOK_LIB("libil2cpp.so", "0x91502C", Update, old_Update);
```
When I turn on the function, nothing happens. When I used "instance" instead of "cashinstance," I got an error and crash. When I tried to use "cashinstance" without checking for nullptr, I got a "null pointer dereference".
What am I doing wrong? Why is my cashinstance still null?