try this :
bool UnlimitedCoin;
void (*set_coinCount)(void *instance, int value);
//the void *instance is a self-created variable.
int (*old_get_coinCount)(void *instance);
int get_coinCount(void *instance) {
//Check if instance is NULL to prevent CRASH
if (instance != NULL &&...