Solved HOOK VOID

Status
Not open for further replies.

power2020202020

Solid & Active Platinian
Original poster
Nov 3, 2022
58
15
8
34
brazil
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;
 
  • Like
Reactions: Dee.cpu

Dee.cpu

Rookie
Nov 9, 2023
1
1
3
46
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!
 
  • Like
Reactions: power2020202020

DaRealPanDa

Co-Administrator
Staff member
Supporting-Team
Global Moderator
Social Media
Mar 12, 2018
6,891
15,721
2,120
27
Skyrim
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.