Oops, started repo in wrong dir

This commit is contained in:
joahreason 2023-11-16 09:43:52 -05:00
parent 499d087e20
commit a1588c56ca
59 changed files with 1047 additions and 0 deletions

38
GoSpec.cs Normal file
View file

@ -0,0 +1,38 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Cvars;
using CounterStrikeSharp.API.Modules.Utils;
namespace GoSpec;
public class GoSpec : BasePlugin
{
public override string ModuleName => "GoSpec";
public override string ModuleAuthor => "cosmic sans";
public override string ModuleVersion => "1.0";
public override void Load(bool hotReload)
{
Console.WriteLine($"{ChatColors.Blue}{ModuleName} v{ModuleVersion} by {ModuleAuthor} is active. Type !spec to switch to spec.");
}
[ConsoleCommand("spec", "Moves you to spec.")]
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_ONLY)]
public void OnSpecCommand(CCSPlayerController? caller, CommandInfo command)
{
if (caller == null) return;
if (caller.PlayerPawn.Value.TeamNum == (int)CsTeam.Spectator) return;
caller.ChangeTeam(CsTeam.Spectator);
if (caller.PlayerPawn.Value.TeamNum != (int)CsTeam.Spectator)
{
caller.PrintToChat($"{ChatColors.Red}Failed to move you to spec.");
return;
}
Server.PrintToChatAll($"{ChatColors.Default}Moving {ChatColors.Green}{caller.PlayerName} {ChatColors.Default}to spec.");
}
}