Solved HOOK VOID

Status
Not open for further replies.

power2020202020

Solid & Active Platinian
Hello, I made a hoking void of invincibility and it worked, it only activates both sides, invincibility in my fighting game for player 1 and player 2, how do I separate it so that it activates me only on the side?

My hoking is like this, I already looked for ismine and in my game there are only isplayer, isleader, isactiveplayer and I tested all 3 and they all worked but they worked for both sides, invincibility I play street fighter 5

bool Godmode = false;

bool (*get_IsLeader)(void *instance);
bool (*old_IsInvincible)(void *instance);
bool IsInvincible(void *instance){
if(instance != NULL && Godmode) {
bool IsLeader = get_IsLeader(instance);
if(IsLeader) {
return true;
}
}
return old_IsInvincible(instance);

-----------------------------------------

MSHookFunction((void *)getAbsoluteAddress("libil2cpp.so", 0x1335C5C), (void *)IsInvincible, (void **) &old_IsInvincible);
get_IsLeader = (bool(*)(void *))getAbsoluteAddress("libil2cpp.so", 0x1333BD0);

-------------------------------------------------

Toggle_20 god mode

switch (featNum) {
case 20:
Godmode = boolean;
break;
 
Hi there, nice job!
So, to make it work separately for each player, you need to identify which player the character belongs to and conditionally apply the invincibility based on that.

Here's a modified version of your code that should help separate the invincibility for each player:
bool GodmodePlayer1 = false;
bool GodmodePlayer2 = false;

bool (*get_IsLeader)(void *instance);
bool (*old_IsInvincible)(void *instance);

bool IsInvincible(void *instance) {
if (instance != NULL) {
bool IsLeader = get_IsLeader(instance);
if (IsLeader) {
return GodmodePlayer1;
} else {
return GodmodePlayer2;
}
}
return old_IsInvincible(instance);
}

// In your toggle function, you can set the Godmode for each player separately.
void ToggleGodMode(int playerNum, bool enabled) {
if (playerNum == 1) {
GodmodePlayer1 = enabled;
} else if (playerNum == 2) {
GodmodePlayer2 = enabled;
}
}

With this modification, you can use the ToggleGodMode function to enable or disable invincibility for each player separately. For example,
ToggleGodMode(1, true) will activate invincibility for Player 1, and ToggleGodMode(2, true) will activate it for Player 2.

Make sure to call the ToggleGodMode function as needed to control invincibility for individual players. I hope this helps, cheers!
 
Thread will be set to "solved" and closed.
When you're not happy with that just send me a message and i will re-open the thread for you.

Thanks.
 
Status
Not open for further replies.
Back
Top Bottom