mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-24 20:26:51 +00:00
Fun menu done without guns, need to test
This commit is contained in:
@@ -600,7 +600,7 @@ namespace CS2_SimpleAdmin
|
|||||||
[ConsoleCommand("css_restart")]
|
[ConsoleCommand("css_restart")]
|
||||||
[ConsoleCommand("css_restartgame")]
|
[ConsoleCommand("css_restartgame")]
|
||||||
[RequiresPermissions("@css/generic")]
|
[RequiresPermissions("@css/generic")]
|
||||||
[CommandHelper(minArgs: 1, usage: "", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
[CommandHelper(minArgs: 0, usage: "", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||||
public void OnRestartCommand(CCSPlayerController? caller, CommandInfo command)
|
public void OnRestartCommand(CCSPlayerController? caller, CommandInfo command)
|
||||||
{
|
{
|
||||||
RestartGame(caller);
|
RestartGame(caller);
|
||||||
|
|||||||
@@ -31,24 +31,30 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
player!.Pawn.Value!.ToggleNoclip();
|
NoClip(caller, player, callerName);
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_noclip_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void NoClip(CCSPlayerController? caller, CCSPlayerController player, string callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
player!.Pawn.Value!.ToggleNoclip();
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_noclip_message", callerName, player.PlayerName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_freeze", "Freeze a player.")]
|
[ConsoleCommand("css_freeze", "Freeze a player.")]
|
||||||
[CommandHelper(1, "<#userid or name> [duration]")]
|
[CommandHelper(1, "<#userid or name> [duration]")]
|
||||||
[RequiresPermissions("@css/slay")]
|
[RequiresPermissions("@css/slay")]
|
||||||
@@ -73,27 +79,34 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
player!.Pawn.Value!.Freeze();
|
Freeze(caller, player, time, callerName);
|
||||||
|
|
||||||
if (time > 0)
|
|
||||||
AddTimer(time, () => player.Pawn.Value!.Unfreeze(), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_freeze_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Freeze(CCSPlayerController? caller, CCSPlayerController player, int time, string callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
player!.Pawn.Value!.Freeze();
|
||||||
|
|
||||||
|
if (time > 0)
|
||||||
|
AddTimer(time, () => player.Pawn.Value!.Unfreeze(), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_freeze_message", callerName, player.PlayerName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_unfreeze", "Unfreeze a player.")]
|
[ConsoleCommand("css_unfreeze", "Unfreeze a player.")]
|
||||||
[CommandHelper(1, "<#userid or name>")]
|
[CommandHelper(1, "<#userid or name>")]
|
||||||
[RequiresPermissions("@css/slay")]
|
[RequiresPermissions("@css/slay")]
|
||||||
@@ -115,21 +128,28 @@ namespace CS2_SimpleAdmin
|
|||||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player!.Pawn.Value!.Unfreeze();
|
Unfreeze(caller, player, callerName);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
public void Unfreeze(CCSPlayerController? caller, CCSPlayerController player, string callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
player!.Pawn.Value!.Unfreeze();
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
{
|
{
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
{
|
{
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
{
|
sb.Append(_localizer["sa_admin_unfreeze_message", callerName, player.PlayerName]);
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
_player.PrintToChat(sb.ToString());
|
||||||
sb.Append(_localizer["sa_admin_unfreeze_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,27 +146,34 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
StripWeapons(caller, player, callerName);
|
||||||
return;
|
|
||||||
|
|
||||||
player.RemoveWeapons();
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_strip_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void StripWeapons(CCSPlayerController? caller, CCSPlayerController player, string callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||||
|
return;
|
||||||
|
|
||||||
|
player.RemoveWeapons();
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_strip_message", callerName, player.PlayerName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_hp")]
|
[ConsoleCommand("css_hp")]
|
||||||
[RequiresPermissions("@css/slay")]
|
[RequiresPermissions("@css/slay")]
|
||||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> <health>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
[CommandHelper(minArgs: 1, usage: "<#userid or name> <health>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||||
@@ -191,27 +198,32 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
SetHp(caller, player, health, callerName);
|
||||||
return;
|
|
||||||
|
|
||||||
player.SetHp(health);
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_hp_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetHp(CCSPlayerController? caller, CCSPlayerController player, int health, string callerName = null)
|
||||||
|
{
|
||||||
|
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||||
|
return;
|
||||||
|
|
||||||
|
player.SetHp(health);
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_hp_message", callerName, player.PlayerName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_speed")]
|
[ConsoleCommand("css_speed")]
|
||||||
[RequiresPermissions("@css/slay")]
|
[RequiresPermissions("@css/slay")]
|
||||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> <speed>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
[CommandHelper(minArgs: 1, usage: "<#userid or name> <speed>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||||
@@ -239,29 +251,31 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
/*
|
SetSpeed(caller, player, speed, callerName);
|
||||||
player.Speed = (float)speed;
|
|
||||||
player.PlayerPawn.Value!.Speed = (float)speed;
|
|
||||||
*/
|
|
||||||
player.SetSpeed((float)speed);
|
|
||||||
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_speed_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetSpeed(CCSPlayerController? caller, CCSPlayerController player, double speed, string callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
player.SetSpeed((float)speed);
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_speed_message", callerName, player.PlayerName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_god")]
|
[ConsoleCommand("css_god")]
|
||||||
[RequiresPermissions("@css/cheats")]
|
[RequiresPermissions("@css/cheats")]
|
||||||
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||||
@@ -286,33 +300,40 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
if (player != null)
|
God(caller, player, callerName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void God(CCSPlayerController? caller, CCSPlayerController player, string callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
if (!godPlayers.Contains(player.Slot))
|
||||||
|
{
|
||||||
|
godPlayers.Add(player.Slot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
godPlayers = new ConcurrentBag<int>(godPlayers.Where(item => item != player.Slot));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
{
|
{
|
||||||
if (!godPlayers.Contains(player.Slot))
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
{
|
{
|
||||||
godPlayers.Add(player.Slot);
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
}
|
sb.Append(_localizer["sa_admin_god_message", callerName, player.PlayerName]);
|
||||||
else
|
_player.PrintToChat(sb.ToString());
|
||||||
{
|
|
||||||
godPlayers = new ConcurrentBag<int>(godPlayers.Where(item => item != player.Slot));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_god_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_slap")]
|
[ConsoleCommand("css_slap")]
|
||||||
@@ -528,30 +549,37 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
if (CBasePlayerController_SetPawnFunc == null || player.PlayerPawn.Value == null || !player.PlayerPawn.IsValid) return;
|
Respawn(caller, player, callerName);
|
||||||
|
|
||||||
var playerPawn = player.PlayerPawn.Value;
|
|
||||||
CBasePlayerController_SetPawnFunc.Invoke(player, playerPawn, true, false);
|
|
||||||
VirtualFunction.CreateVoid<CCSPlayerController>(player.Handle,
|
|
||||||
GameData.GetOffset("CCSPlayerController_Respawn"))(player);
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_respawn_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Respawn(CCSPlayerController? caller, CCSPlayerController player, string callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
if (CBasePlayerController_SetPawnFunc == null || player.PlayerPawn.Value == null || !player.PlayerPawn.IsValid) return;
|
||||||
|
|
||||||
|
var playerPawn = player.PlayerPawn.Value;
|
||||||
|
CBasePlayerController_SetPawnFunc.Invoke(player, playerPawn, true, false);
|
||||||
|
VirtualFunction.CreateVoid<CCSPlayerController>(player.Handle,
|
||||||
|
GameData.GetOffset("CCSPlayerController_Respawn"))(player);
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_respawn_message", callerName, player.PlayerName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_tp", "Teleport to a player.")]
|
[ConsoleCommand("css_tp", "Teleport to a player.")]
|
||||||
[ConsoleCommand("css_tpto", "Teleport to a player.")]
|
[ConsoleCommand("css_tpto", "Teleport to a player.")]
|
||||||
[ConsoleCommand("css_goto", "Teleport to a player.")]
|
[ConsoleCommand("css_goto", "Teleport to a player.")]
|
||||||
|
|||||||
@@ -41,29 +41,15 @@ public static class PlayerExtensions
|
|||||||
public static void SetHp(this CCSPlayerController controller, int health = 100)
|
public static void SetHp(this CCSPlayerController controller, int health = 100)
|
||||||
{
|
{
|
||||||
if (health <= 0 || !controller.PawnIsAlive || controller.PlayerPawn.Value == null) return;
|
if (health <= 0 || !controller.PawnIsAlive || controller.PlayerPawn.Value == null) return;
|
||||||
|
|
||||||
controller.Health = health;
|
|
||||||
controller.PlayerPawn.Value.Health = health;
|
controller.PlayerPawn.Value.Health = health;
|
||||||
|
|
||||||
if (health > 100)
|
if (health > 100)
|
||||||
{
|
{
|
||||||
controller.MaxHealth = health;
|
|
||||||
controller.PlayerPawn.Value.MaxHealth = health;
|
controller.PlayerPawn.Value.MaxHealth = health;
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlayer_WeaponServices? weaponServices = controller.PlayerPawn.Value!.WeaponServices;
|
Utilities.SetStateChanged(controller.PlayerPawn.Value, "CBaseEntity", "m_iHealth");
|
||||||
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)
|
public static void Bury(this CBasePlayerPawn pawn, float depth = 10f)
|
||||||
|
|||||||
@@ -40,13 +40,10 @@ namespace CS2_SimpleAdmin.Menus
|
|||||||
{
|
{
|
||||||
options.Add(new ChatMenuOptionData("Strip All Weapons", () => PlayersMenu.OpenMenu(admin, "Strip All Weapons", StripWeapons)));
|
options.Add(new ChatMenuOptionData("Strip All Weapons", () => PlayersMenu.OpenMenu(admin, "Strip All Weapons", StripWeapons)));
|
||||||
options.Add(new ChatMenuOptionData("Freeze", () => PlayersMenu.OpenMenu(admin, "Freeze", Freeze)));
|
options.Add(new ChatMenuOptionData("Freeze", () => PlayersMenu.OpenMenu(admin, "Freeze", Freeze)));
|
||||||
options.Add(new ChatMenuOptionData("HP", () => PlayersMenu.OpenMenu(admin, "HP", HP)));
|
options.Add(new ChatMenuOptionData("HP", () => PlayersMenu.OpenMenu(admin, "HP", SetHpMenu)));
|
||||||
options.Add(new ChatMenuOptionData("Speed", () => PlayersMenu.OpenMenu(admin, "Speed", Speed)));
|
options.Add(new ChatMenuOptionData("Speed", () => PlayersMenu.OpenMenu(admin, "Speed", SetSpeedMenu)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
options.Add(new ChatMenuOptionData("Restart Game", () => CS2_SimpleAdmin.Instance.RestartGame(admin)));
|
|
||||||
|
|
||||||
foreach (ChatMenuOptionData menuOptionData in options)
|
foreach (ChatMenuOptionData menuOptionData in options)
|
||||||
{
|
{
|
||||||
string menuName = menuOptionData.name;
|
string menuName = menuOptionData.name;
|
||||||
@@ -57,20 +54,97 @@ namespace CS2_SimpleAdmin.Menus
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void GodMode(CCSPlayerController admin, CCSPlayerController player) { }
|
private static void GodMode(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.God(admin, player);
|
||||||
|
}
|
||||||
|
|
||||||
private static void NoClip(CCSPlayerController admin, CCSPlayerController player) { }
|
private static void NoClip(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.NoClip(admin, player);
|
||||||
|
}
|
||||||
|
|
||||||
private static void Respawn(CCSPlayerController admin, CCSPlayerController player) { }
|
private static void Respawn(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.Respawn(admin, player);
|
||||||
|
}
|
||||||
|
|
||||||
private static void GiveWeaponMenu(CCSPlayerController admin, CCSPlayerController player) { }
|
private static void GiveWeaponMenu(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
// TODO: show weapon menu
|
||||||
|
}
|
||||||
|
|
||||||
private static void StripWeapons(CCSPlayerController admin, CCSPlayerController player) { }
|
private static void StripWeapons(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.StripWeapons(admin, player);
|
||||||
|
}
|
||||||
|
|
||||||
private static void Freeze(CCSPlayerController admin, CCSPlayerController player) { }
|
private static void Freeze(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
if (player.PlayerPawn.Value.MoveType == MoveType_t.MOVETYPE_OBSOLETE)
|
||||||
|
CS2_SimpleAdmin.Instance.Freeze(admin, player, -1);
|
||||||
|
else
|
||||||
|
CS2_SimpleAdmin.Instance.Unfreeze(admin, player);
|
||||||
|
}
|
||||||
|
|
||||||
private static void HP(CCSPlayerController admin, CCSPlayerController player) { }
|
private static void SetHpMenu(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
Tuple<string, int>[] _hpArray = new[]
|
||||||
|
{
|
||||||
|
new Tuple<string, int>("1", 1),
|
||||||
|
new Tuple<string, int>("10", 10),
|
||||||
|
new Tuple<string, int>("25", 25),
|
||||||
|
new Tuple<string, int>("50", 50),
|
||||||
|
new Tuple<string, int>("100", 100),
|
||||||
|
new Tuple<string, int>("200", 200),
|
||||||
|
new Tuple<string, int>("500", 500),
|
||||||
|
new Tuple<string, int>("999", 999)
|
||||||
|
};
|
||||||
|
|
||||||
private static void Speed(CCSPlayerController admin, CCSPlayerController player) { }
|
BaseMenu menu = AdminMenu.CreateMenu("Set HP");
|
||||||
|
|
||||||
|
foreach (Tuple<string, int> hpTuple in _hpArray)
|
||||||
|
{
|
||||||
|
string optionName = hpTuple.Item1;
|
||||||
|
menu.AddMenuOption(optionName, (_, _) => { SetHP(admin, player, hpTuple.Item2); });
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetHP(CCSPlayerController admin, CCSPlayerController player, int hp)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.SetHp(admin, player, hp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetSpeedMenu(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
Tuple<string, float>[] _speedArray = new[]
|
||||||
|
{
|
||||||
|
new Tuple<string, float>("0.1", .1f),
|
||||||
|
new Tuple<string, float>("0.25", .25f),
|
||||||
|
new Tuple<string, float>("0.5", .5f),
|
||||||
|
new Tuple<string, float>("0.75", .75f),
|
||||||
|
new Tuple<string, float>("1", 1),
|
||||||
|
new Tuple<string, float>("2", 2),
|
||||||
|
new Tuple<string, float>("3", 3),
|
||||||
|
new Tuple<string, float>("4", 4),
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu("Set Speed");
|
||||||
|
|
||||||
|
foreach (Tuple<string, float> speedTuple in _speedArray)
|
||||||
|
{
|
||||||
|
string optionName = speedTuple.Item1;
|
||||||
|
menu.AddMenuOption(optionName, (_, _) => { SetSpeed(admin, player, speedTuple.Item2); });
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetSpeed(CCSPlayerController admin, CCSPlayerController player, float speed)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.SetSpeed(admin, player, speed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user