1.2.2a UPDATE

- Fixed css_addban, css_addmute
- New command `css_hp`
- New command `css_god`
- New command `css_speed`
This commit is contained in:
daffyyyy
2023-12-13 20:20:12 +01:00
parent 15ab2d9e65
commit 28f6cf63fe
8 changed files with 390 additions and 219 deletions

View File

@@ -25,6 +25,34 @@ public static class PlayerUtils
return AdminManager.CanPlayerTarget(controller, target);
}
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;
}
var 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;
}
}
}
public static void Bury(this CBasePlayerPawn pawn, float depth = 10f)
{
var newPos = new Vector(pawn.AbsOrigin!.X, pawn.AbsOrigin.Y,