add: Revive function

This commit is contained in:
jadis0x
2022-10-08 01:15:28 +03:00
committed by GitHub
parent 6ca06d5169
commit 68b8c5e1d4

View File

@@ -474,3 +474,35 @@ void Misc::KnockoutPlayers(bool killYourself) {
return;
}
}
void Misc::Revive(bool reviveEveryone) {
Unity::CComponent* SurvivalReviveInteractable = Players::LocalPlayer->GetComponent("SurvivalReviveInteractable");
if (!SurvivalReviveInteractable) {
return;
}
if (reviveEveryone) {
try {
for (Unity::CGameObject* player : Players::PlayerList) {
if (!player || player == Players::LocalPlayer) {
continue;
}
player->GetComponent("SurvivalReviveInteractable")->CallMethodSafe<void*>("Interact", player);
}
}
catch (...) {
return;
}
}
else {
try {
SurvivalReviveInteractable->CallMethodSafe<void*>("Interact", Players::LocalPlayer);
}
catch (...) {
return;
}
}
}