public async Task RevivePlayer(IPlayer player, IPlayer targetPlayer) { try { if (player == null || !player.Exists || targetPlayer == null || !targetPlayer.Exists) { return; } int targetId = (int)targetPlayer.GetCharacterMetaId(); int charId = (int)player.GetCharacterMetaId(); if (charId <= 0 || targetId <= 0 || !Characters.IsCharacterUnconscious(targetId)) { return; } if (!CharactersInventory.ExistCharacterItem(charId, "Defibrilator", "inventory") && !CharactersInventory.ExistCharacterItem(charId, "Defibrilator", "backpack")) { HUDHandler.SendNotification(player, 3, 3500, "Du hast keinen Defibrilator dabei."); return; } InventoryHandler.InventoryAnimation(player, "revive", 15000); int rnd = new Random().Next(1, 100); await Task.Delay(15000); if (rnd >= 1 && rnd <= 50) { //Reanimation erfolgreich if (!player.IsInVehicle) { InventoryHandler.StopAnimation(player, "missheistfbi3b_ig8_2", "cpr_loop_paramedic"); } if (targetId <= 0 || !Characters.IsCharacterUnconscious(targetId)) { return; } Characters.SetCharacterUnconscious(targetId, false, 0); DeathHandler.revive(targetPlayer); Characters.SetCharacterHealth(targetId, 115); targetPlayer.Health = 115; } else if (rnd >= 51 && rnd <= 100) { //Reanimation nicht erfolgreich if (!player.IsInVehicle) { InventoryHandler.StopAnimation(player, "missheistfbi3b_ig8_2", "cpr_loop_paramedic"); } HUDHandler.SendNotification(player, 3, 3500, "Die Renimation war nicht erfolgreich, versuch es weiter!"); } } catch (Exception e) { Alt.Log($"{e}"); } }