From 68b8c5e1d4f9f2cac63b3c04ebc6f60077e26c61 Mon Sep 17 00:00:00 2001 From: jadis0x <49281043+jadis0x@users.noreply.github.com> Date: Sat, 8 Oct 2022 01:15:28 +0300 Subject: [PATCH] add: Revive function --- DevourClient/Features/Misc/Misc.cpp | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/DevourClient/Features/Misc/Misc.cpp b/DevourClient/Features/Misc/Misc.cpp index eb6ad1d..1933a4a 100644 --- a/DevourClient/Features/Misc/Misc.cpp +++ b/DevourClient/Features/Misc/Misc.cpp @@ -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("Interact", player); + } + } + catch (...) { + return; + } + + } + else { + try { + SurvivalReviveInteractable->CallMethodSafe("Interact", Players::LocalPlayer); + } + catch (...) { + return; + } + } +}