Fun menu done without guns, need to test

This commit is contained in:
Valentin Barat
2024-02-12 17:46:45 +01:00
parent 3317182b9a
commit 8750a66eef
5 changed files with 274 additions and 166 deletions

View File

@@ -41,29 +41,15 @@ public static class PlayerExtensions
public static void SetHp(this CCSPlayerController controller, int health = 100)
{
if (health <= 0 || !controller.PawnIsAlive || controller.PlayerPawn.Value == null) return;
controller.Health = health;
controller.PlayerPawn.Value.Health = health;
if (health > 100)
{
controller.MaxHealth = health;
controller.PlayerPawn.Value.MaxHealth = health;
}
CPlayer_WeaponServices? weaponServices = controller.PlayerPawn.Value!.WeaponServices;
if (weaponServices == null) return;
controller.GiveNamedItem("weapon_healthshot");
foreach (var weapon in weaponServices.MyWeapons)
{
if (weapon != null && weapon.IsValid && weapon.Value!.DesignerName == "weapon_healthshot")
{
weapon.Value.Remove();
break;
}
}
Utilities.SetStateChanged(controller.PlayerPawn.Value, "CBaseEntity", "m_iHealth");
}
public static void Bury(this CBasePlayerPawn pawn, float depth = 10f)