### Install SwiftlyS2 Package Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/getting-started.mdx Command to install the SwiftlyS2 package using the .NET CLI. ```bash dotnet new install SwiftlyS2.CS2.PluginTemplate ``` -------------------------------- ### Folder Structure Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/getting-started.mdx Example folder structure for a SwiftlyS2 plugin created from the template. ```json { "build": {}, "examples": { "Commands.example.cs": {}, "Events.example.cs": {}, "GameEvents.example.cs": {}, "HookAndCallNativeFunctions.example.cs": {}, "NetMessage.example.cs": {}, "SoundEvent.example.cs": {} }, "src": { "PluginClassName.cs": {} }, "README.md": {}, "PluginId.csproj": {} } ``` -------------------------------- ### Publish Plugin Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/getting-started.mdx Command to build a publish version of the plugin. ```bash dotnet publish ``` -------------------------------- ### Quick Start Menu Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/menus.mdx A basic example of creating and opening a menu with a title, max visible items, a text option, and a button option. ```csharp var menu = Core.MenusAPI.CreateBuilder() .Design.SetMenuTitle("Match Settings") .Design.SetMaxVisibleItems(5) .AddOption(new TextMenuOption("Configure the round before it starts")) .AddOption(new ButtonMenuOption("Start match")) .Build(); Core.MenusAPI.OpenMenuForPlayer(player, menu); ``` -------------------------------- ### Startup Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/resources/cli-options.mdx Example of launching the CS2 dedicated server with SwiftlyS2 CLI options. ```bash ./game/bin/win64/cs2.exe -dedicated +map de_dust2 \ -sw_path addons/swiftlys2 \ -sw_logpath addons/swiftlys2/logs \ -sw_hide_logs_in_console 1 \ -sw_loglevel WARNING ``` -------------------------------- ### gameinfo.gi modification with MetaMod Source: https://github.com/swiftly-solution/website/blob/main/content/docs/installation.mdx Example of gameinfo.gi modification when MetaMod is also installed. ```text ... Game csgo/addons/metamod Game csgo/addons/swiftlys2 ... ``` -------------------------------- ### Setting and Getting Values Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/convars.mdx Example of setting and getting convar values. ```csharp enabled.Value = false; Console.WriteLine(enabled.Value); ``` -------------------------------- ### OneBoneStart Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/ikdemocapturesettings_t.mdx Represents the start bone name for a one-bone IK setup. ```csharp string OneBoneStart { get; set; } ``` -------------------------------- ### Direct `CreateMenu` Usage Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/menus.mdx Example of using `CreateMenu` with explicit configuration and keybind overrides for advanced menu setup. ```csharp var configuration = new MenuConfiguration { Title = "Raw Menu", HideTitle = false, HideFooter = false, PlaySound = true, MaxVisibleItems = 5 }; var overrides = new MenuKeybindOverrides { Select = KeyBind.E, Move = KeyBind.W, MoveBack = KeyBind.S, Exit = KeyBind.Esc }; var menu = Core.MenusAPI.CreateMenu( configuration, overrides, parent: null, optionScrollStyle: MenuOptionScrollStyle.CenterFixed, optionTextStyle: MenuOptionTextStyle.TruncateEnd ); menu.AddOption(new ButtonMenuOption("Continue")); Core.MenusAPI.OpenMenuForPlayer(player, menu); ``` -------------------------------- ### SetUp Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_op_modelsurfacesnapshotgenerator.mdx Property definition for SetUp. ```csharp ref bool SetUp { get; } ``` -------------------------------- ### Method Chaining Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/configuration.mdx All setup methods return the configuration service, allowing fluent setup in one block. ```csharp Core.Configuration .InitializeJsonWithModel("config.jsonc", "Main") .InitializeTomlWithModel("database.toml", "Database") .Configure(builder => { builder.AddJsonFile("config.jsonc", optional: false, reloadOnChange: true); builder.AddTomlFile("database.toml", optional: false, reloadOnChange: true); }); ``` -------------------------------- ### MyPlugin Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/swiftly-core.mdx Example of how BasePlugin receives ISwiftlyCore in its constructor and exposes it through Core. ```csharp public sealed class MyPlugin : BasePlugin { public MyPlugin(ISwiftlyCore core) : base(core) { } public override void Load(bool hotReload) { Core.Logger.LogInformation("Plugin loaded. Hot reload: {HotReload}", hotReload); } public override void Unload() { Core.Logger.LogInformation("Plugin unloaded."); } } ``` -------------------------------- ### Plugin Configuration Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/guides/porting-from-css.mdx Example of a plugin configuration class and the generated JSON. ```csharp public sealed class PluginConfig { public string DatabaseConnection { get; set; } = ""; public int MaxPlayers { get; set; } = 10; public bool EnableFeature { get; set; } = true; } ``` ```json { "MyPlugin": { "DatabaseConnection": "", "MaxPlayers": 10, "EnableFeature": true } } ``` -------------------------------- ### Complete Plugin Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/swiftly-core.mdx A comprehensive example demonstrating plugin loading, unloading, event subscription, and logging using ISwiftlyCore services. ```csharp private EventDelegates.OnClientConnected? _onClientConnected; public override void Load(bool hotReload) { Core.Logger.LogInformation("Plugin path: {Path}", Core.PluginPath); Core.Logger.LogInformation("Data path: {Path}", Core.PluginDataDirectory); _onClientConnected = OnClientConnected; Core.Event.OnClientConnected += _onClientConnected; } public override void Unload() { if (_onClientConnected != null) { Core.Event.OnClientConnected -= _onClientConnected; } } private void OnClientConnected(IOnClientConnectedEvent @event) { Core.Scheduler.NextTick(() => { Core.Logger.LogInformation("Client connected: {PlayerId}", @event.PlayerId); }); } ``` -------------------------------- ### Project File (.csproj) Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/guides/porting-from-css.mdx A full example of a .csproj file for a SwiftlyS2 plugin with comments explaining each setting. ```xml net10.0 enable enable latest true $(MSBuildThisFileName) $(MSBuildThisFileName) false true true $(MSBuildThisFileDirectory)build/ $(OutputPath)publish/$(MSBuildThisFileName) ``` -------------------------------- ### Create a plugin from template Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/getting-started.mdx Placeholder for the DotnetTemplateGenerator component, which is used to create a new plugin from a template. ```json ``` -------------------------------- ### Global Database Configuration Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/database.mdx Example JSON configuration for database connections. ```json { "default_connection": "host", "connections": { "host": "mysql://username:password@localhost:3306/database", "analytics": "postgresql://username:password@localhost:5432/database", "local": "sqlite://data/local.db" } } ``` -------------------------------- ### Load Method Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/guides/dependency-injection.mdx Example of setting up ServiceCollection and building a ServiceProvider in the Load method. ```csharp public override void Load(bool hotReload) { ServiceCollection services = new(); services .AddSwiftly(Core) .AddSingleton(); var provider = services.BuildServiceProvider(); provider.GetRequiredService(); // This execute TestService constructor with dependencies it needs. } ``` -------------------------------- ### WarpStartTime Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_positionwarp.mdx Gets the start time for the warp. ```csharp ref float WarpStartTime { get; } ``` -------------------------------- ### Update Version Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/getting-started.mdx Placeholder for the VersionGetter component, used to update the package version in the template. ```json ``` -------------------------------- ### LerpToNewPosStartInPathEntitySpace Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cfuncmover.mdx Gets the start position for lerping in path entity space. ```csharp ref Vector LerpToNewPosStartInPathEntitySpace { get; } ``` -------------------------------- ### EnsureMainThreadAction Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/swiftly-core.mdx Example demonstrating how to ensure an action is executed on the game thread using Core.IsGameThread and Core.Scheduler. ```csharp public void EnsureMainThreadAction(Action action) { if (Core.IsGameThread) { action(); return; } Core.Scheduler.NextTick(action); } ``` -------------------------------- ### Start Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cpulsecell_lerpcamerasettings.mdx The C# code snippet for the 'Start' property of the CPulseCell_LerpCameraSettings interface. ```csharp PointCameraSettings_t Start { get; } ``` -------------------------------- ### Dapper Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/database.mdx Example of using Dapper with a database connection obtained from SwiftlyS2. ```csharp using var connection = Core.Database.GetConnection("host"); var players = await connection.QueryAsync( "SELECT steam_id, name FROM players WHERE is_active = @IsActive", new { IsActive = true } ); ``` -------------------------------- ### ModerationHandlers Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/using-attributes.mdx Example of registering a ClientChatHookHandler and a custom handler instance. ```csharp public sealed class ModerationHandlers { [ClientChatHookHandler] public HookResult OnClientChat(int playerId, string text, bool teamonly) { if (text.Contains("badword", StringComparison.OrdinalIgnoreCase)) { return HookResult.Stop; } return HookResult.Continue; } } public override void Load(bool hotReload) { var handlers = new ModerationHandlers(); Core.Registrator.Register(handlers); } ``` -------------------------------- ### EventDelegates.OnStartupServer Delegate Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/events/eventdelegates/onstartupserver.mdx Called when the server is started. ```csharp public delegate void EventDelegates.OnStartupServer() ``` -------------------------------- ### Complete Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/convars.mdx A complete example of how to create and use convars in a Swiftly plugin. ```csharp [PluginMetadata(Id = "MyPlugin", Version = "1.0.0", Name = "My Own Plugin", Author = "myself", Description = "i created this plugin")] public partial class MyPlugin : BasePlugin { private IConVar? _enabled; private IConVar? _maxBots; public override void Load(bool hotReload) { _enabled = Core.ConVar.CreateOrFind( "sw_plugin_enabled", "Enable or disable this plugin.", true, ConvarFlags.NONE ); _maxBots = Core.ConVar.CreateOrFind( "sw_plugin_max_bots", "Maximum amount of bots.", 6, 0, 20, ConvarFlags.NONE ); _enabled.Value = true; _maxBots.SetInternal(10); _enabled.QueryClient(0, value => { Console.WriteLine($"Client #0 sees sw_plugin_enabled={value}"); }); } } ``` -------------------------------- ### Complete Example: Consumer Plugin Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/shared-api.mdx Example of a consumer plugin using the Economy API. ```csharp using MyPlugin.Contracts; public class ShopPlugin : BasePlugin { private IEconomyApi? _economyApi; public override void UseSharedInterface(IInterfaceManager interfaceManager) { interfaceManager.TryGetSharedInterface("Economy.Api.v1", out _economyApi); } public void TryBuy(IPlayer player, int cost) { if (_economyApi == null) { player.PrintToChat("Economy service is unavailable."); return; } if (!_economyApi.TrySpend(player.SteamID, cost)) { player.PrintToChat("Not enough balance."); return; } player.PrintToChat("Purchase successful."); } } ``` -------------------------------- ### Start Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/protobufdefinitions/cmsgeffectdata.mdx Represents the starting point, possibly for a trajectory or animation. ```csharp Vector Start { get; set; } ``` -------------------------------- ### PathLocationStart Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cfuncmover.mdx The starting location for path movement. ```csharp ref float PathLocationStart { get; } ``` -------------------------------- ### Start Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cseqautolayer.mdx The 'Start' property of the CSeqAutoLayer interface. ```csharp ref float Start { get; } ``` -------------------------------- ### StartIndex Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/canimgraphdebugreplay.mdx Gets the start index. ```csharp ref int StartIndex { get; } ``` -------------------------------- ### StartTransitionTime Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/csplineconstraint.mdx Gets the start time of the transition. ```csharp GameTime_t StartTransitionTime { get; } ``` -------------------------------- ### SnapShotStartPoint Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_initskinnedpositionfromcpsnapshot.mdx The starting point for a snapshot. ```csharp ref int SnapShotStartPoint { get; } ``` -------------------------------- ### TestService Class Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/guides/dependency-injection.mdx Example of a TestService class demonstrating constructor injection of dependencies like ISwiftlyCore, ILogger, and IOptionsMonitor. ```csharp // TestService.cs public class TestService { private ISwiftlyCore Core { get; init; } public TestService(ISwiftlyCore core, ILogger logger, IOptionsMonitor config) { Core = core; logger.LogInformation("TestService created"); logger.LogInformation("Config: {Config}", config.CurrentValue.Age); core.Registrator.Register(this); } [Command("test")] public void TestCommand(ICommandContext context) { Core.NetMessage.Send(um => { um.Frequency = 1f; um.Recipients.AddAllPlayers(); }); context.Reply("Test command"); } } ``` -------------------------------- ### StartTimeInCommentary Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cpointcommentarynode.mdx Gets a reference to the start time within the commentary. ```csharp ref float StartTimeInCommentary { get; } ``` -------------------------------- ### Complete Example - 3. Consume with IOptionsMonitor Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/configuration.mdx Demonstrates how to consume configuration settings using IOptionsMonitor and handle reload events. ```csharp public class ExampleService { private readonly IOptionsMonitor _main; private readonly IOptionsMonitor _database; public ExampleService(IOptionsMonitor main, IOptionsMonitor database) { _main = main; _database = database; _main.OnChange(newConfig => { Console.WriteLine($"Main config reloaded. Enabled: {newConfig.Enabled}"); }); } public void PrintSettings() { Console.WriteLine($"Debug: {_main.CurrentValue.Debug}"); Console.WriteLine($"DB Host: {_database.CurrentValue.Host}:{_database.CurrentValue.Port}"); } } ``` -------------------------------- ### OnCommentaryStarted Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cpointcommentarynode.mdx Gets a reference to the output entity for when commentary starts. ```csharp ref CEntityIOOutput OnCommentaryStarted { get; } ``` -------------------------------- ### Complete Example - 1. Define Configuration Models Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/configuration.mdx Defines the C# models for configuration settings. ```csharp namespace MyPlugin; public class MainConfig { public bool Enabled { get; set; } = true; public bool Debug { get; set; } = false; public int MaxPlayers { get; set; } = 32; } public class DatabaseConfig { public string Host { get; set; } = "127.0.0.1"; public int Port { get; set; } = 3306; } ``` -------------------------------- ### Getting All Players Source: https://github.com/swiftly-solution/website/blob/main/content/docs/guides/porting-from-css.mdx Shows how to get a list of all players currently in the game. ```csharp var players = Utilities.GetPlayers(); ``` ```csharp var players = Core.PlayerManager.GetAllPlayers(); ``` -------------------------------- ### Get Configuration File Path Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/configuration.mdx Gets the full path for a specific configuration file. Expects the file name including extension. ```csharp string configPath = Core.Configuration.GetConfigPath("config.jsonc"); ``` -------------------------------- ### Example Translation File Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/translations.mdx An example of a JSONC translation file with general, command feedback, and error keys. ```jsonc { // General "plugin.name": "My Plugin", "plugin.ready": "Plugin is ready.", // Command feedback "command.heal.success": "You have been healed.", "command.heal.other": "{0} healed {1}", "command.heal.no_permission": "You do not have permission.", // Errors "error.player_not_found": "Player '{0}' was not found." } ``` -------------------------------- ### TangentSpaceAnchorAtTransitionStart Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/csplineconstraint.mdx Gets the tangent space anchor position at the start of the transition. ```csharp ref Vector TangentSpaceAnchorAtTransitionStart { get; } ``` -------------------------------- ### Init Method Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/steamapi/gameserver.mdx Initializes the game server with specified parameters. ```csharp public static bool Init(uint unIP, ushort usGamePort, ushort usQueryPort, EServerMode eServerMode, string pchVersionString) ``` -------------------------------- ### Complete Example - 2. Initialize in Plugin Load Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/configuration.mdx Initializes configuration models and services within the plugin's Load method. ```csharp public override void Load(bool hotReload) { Core.Configuration .InitializeJsonWithModel("config.jsonc", "Main") .InitializeTomlWithModel("database.toml", "Database") .Configure(builder => { builder.AddJsonFile("config.jsonc", optional: false, reloadOnChange: true); builder.AddTomlFile("database.toml", optional: false, reloadOnChange: true); }); var services = new ServiceCollection(); services.AddSwiftly(Core); services.AddOptionsWithValidateOnStart().BindConfiguration("Main"); services.AddOptionsWithValidateOnStart().BindConfiguration("Database"); } ``` -------------------------------- ### NameAttachStart Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cphysicsspring.mdx Gets or sets the name of the attachment point at the start of the spring. ```csharp string NameAttachStart { get; set; } ``` -------------------------------- ### Submenu Examples Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/menus.mdx Shows how to create a pre-built submenu and a lazily built submenu using SubmenuMenuOption. ```csharp var advancedMenu = Core.MenusAPI.CreateBuilder() .Design.SetMenuTitle("Advanced") .AddOption(new ButtonMenuOption("Do advanced action")) .Build(); var openAdvanced = new SubmenuMenuOption("Advanced", advancedMenu); var lazyAdvanced = new SubmenuMenuOption("Lazy Advanced", () => { return Core.MenusAPI.CreateBuilder() .Design.SetMenuTitle("Loaded On Demand") .AddOption(new TextMenuOption("This submenu was built on click")) .Build(); }); ``` -------------------------------- ### Unhooking Net-Messages Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/netmessages.mdx Examples of unhooking specific messages by GUID or type. ```csharp Core.NetMessage.Unhook(hookGuid); Core.NetMessage.UnhookClientMessage(); Core.NetMessage.UnhookServerMessage(); Core.NetMessage.UnhookServerMessageInternal(); ``` -------------------------------- ### Open and Close Menus Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/menus.mdx Demonstrates various methods for opening and closing menus for players and globally. ```csharp Core.MenusAPI.OpenMenuForPlayer(player, menu); Core.MenusAPI.CloseActiveMenu(player); Core.MenusAPI.OpenMenu(menu); Core.MenusAPI.CloseMenu(menu); Core.MenusAPI.CloseAllMenus(); var current = Core.MenusAPI.GetCurrentMenu(player); ``` -------------------------------- ### PathNodeStart Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cfuncmover.mdx The name of the start node on the path. ```csharp string PathNodeStart { get; set; } ``` -------------------------------- ### Builder Configuration Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/menus.mdx Demonstrates configuring various aspects of a menu builder, including sound, player freezing, auto-close delay, keybinds for selection, movement, exit, and extra buttons, as well as design properties like title, item count visibility, footer visibility, comment visibility, default comment, max visible items, and global scroll style. ```csharp var menu = Core.MenusAPI.CreateBuilder() .EnableSound() .SetPlayerFrozen(false) .SetAutoCloseDelay(0f) .SetSelectButton(KeyBind.E | KeyBind.Mouse1) .SetMoveForwardButton(KeyBind.W) .SetMoveBackwardButton(KeyBind.S) .SetExitButton(KeyBind.Esc) .AddExtraButton(KeyBind.R, "Reset", (p, m) => { p.PrintToChat("Reset action executed."); }) .Design.SetMenuTitle("Gameplay Settings") .Design.SetMenuTitleItemCountVisible(true) .Design.SetMenuFooterVisible(true) .Design.SetCommentVisible(true) .Design.SetDefaultComment("Use W/S to move and E to select") .Design.SetMaxVisibleItems(5) .Design.SetGlobalScrollStyle(MenuOptionScrollStyle.WaitingCenter) .Build(); ``` -------------------------------- ### VelMulAtJumpStart Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/ccsplayer_movementservices.mdx Gets a reference to a float value representing the velocity multiplier at the start of a jump. ```csharp ref float VelMulAtJumpStart { get; } ``` -------------------------------- ### TimeMovementStart Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cfuncmover.mdx The game time when movement started. ```csharp GameTime_t TimeMovementStart { get; } ``` -------------------------------- ### StartPos Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_op_gamedecalrenderer.mdx The starting position for the decal. ```csharp CPerParticleVecInput StartPos { get; } ``` -------------------------------- ### Workshop Downloads with SteamGameServerUGC Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/steamworks.mdx Example of checking if a workshop item is installed and initiating a download if not, using SteamGameServerUGC. ```csharp PublishedFileId_t fileId = new PublishedFileId_t(3070212801); EItemState state = (EItemState)SteamGameServerUGC.GetItemState(fileId); if ((state & EItemState.k_EItemStateInstalled) != 0) { Core.Logger.LogInformation("Workshop item already installed: {ItemId}", fileId.m_PublishedFileId); } else { bool started = SteamGameServerUGC.DownloadItem(fileId, true); Core.Logger.LogInformation("Workshop download start for {ItemId}: {Started}", fileId.m_PublishedFileId, started); } ``` -------------------------------- ### Global Database Configuration Source: https://github.com/swiftly-solution/website/blob/main/content/docs/guides/porting-from-css.mdx Example of a global database configuration file. ```json { "default_connection": "host", "connections": { "host": "mysql://username:password@localhost:3306/database" } } ``` -------------------------------- ### HintLayoutfile Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/gameeventdefinitions/eventinstructorserverhintcreate.mdx Path for Panorama layout file ```csharp string HintLayoutfile { get; set; } ``` -------------------------------- ### Working with Event Data (Accessor) Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/game-events.mdx Example of using the Accessor to get raw payload field data from a game event. ```csharp private HookResult OnPlayerDeath(EventPlayerDeath @event) { string weapon = @event.Accessor.GetString("weapon"); int attackerSlot = @event.Accessor.GetPlayerSlot("attacker"); Console.WriteLine($"attacker slot="{attackerSlot}", weapon="{weapon}"); return HookResult.Continue; } ``` -------------------------------- ### Start Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/protobufdefinitions/cmsgtebeamentpoint.mdx The 'Start' property of the CMsgTEBeamEntPoint interface, representing the start point of the beam as a Vector. ```csharp Vector Start { get; set; } ``` -------------------------------- ### Init Method Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/steamapi/steamapi.mdx Initializes the Steam API. Returns true if successful, false otherwise. ```csharp public static bool Init() ``` -------------------------------- ### Initialize with Template Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/configuration.mdx Initializes configuration files from packaged templates. Templates should be placed in a 'templates' folder within the plugin. ```csharp Core.Configuration.InitializeWithTemplate("config.jsonc", "config.template.jsonc"); Core.Configuration.InitializeWithTemplate("database.toml", "database.template.toml"); ``` -------------------------------- ### Start Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cseqposeparamdesc.mdx The C# definition for the 'Start' property. ```csharp ref float Start { get; } ``` -------------------------------- ### Init() Method Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/steamapi/servernetadr_t.mdx Initializes the server network address with IP, query port, and connection port. ```csharp public void Init(uint ip, ushort usQueryPort, ushort usConnectionPort) ``` -------------------------------- ### Started Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/csceneeventinfo.mdx Represents whether the scene event has started. ```csharp ref bool Started { get; } ``` -------------------------------- ### Guid Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/protobufdefinitions/csvcmsg_sounds_sounddata_t.mdx Represents the unique identifier (GUID) for the sound. ```csharp uint Guid { get; set; } ``` -------------------------------- ### Creating a Menu (SwiftlyS2) Source: https://github.com/swiftly-solution/website/blob/main/content/docs/guides/porting-from-css.mdx Example of creating a menu using the SwiftlyS2 API. ```csharp var menu = Core.MenusAPI .CreateBuilder() .Design.SetMenuTitle("Title") .Design.SetMenuTitleVisible(true) // All options below are optional .Design.SetMenuFooterVisible(true) .Design.SetGlobalScrollStyle(MenuOptionScrollStyle.LinearScroll) // doesn't wrap when reaching the end .SetAutoCloseDelay(10) // auto close after 10 seconds .SetSelectButton(KeyBind.Space) // button to select option .SetPlayerFrozen(false); // don't freeze player while menu is open var button = new ButtonMenuOption("Option 1"); button.Click += (player, option) => { // handle click return ValueTask.CompletedTask; }; menu.AddOption(button); var builtMenu = menu.Build(); Core.MenusAPI.OpenMenuForPlayer(player, builtMenu); ``` -------------------------------- ### InitializeWithTemplate Method Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/services/ipluginconfigurationservice.mdx Initializes the configuration file with a template. Requires a templates folder in the plugin with the template file. ```csharp IPluginConfigurationService InitializeWithTemplate(string name, string templateName) ``` -------------------------------- ### HintName Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/gameeventdefinitions/eventinstructorcloselesson.mdx The name of the lesson to start. Must match instructor_lesson.txt. ```csharp string HintName { get; set; } ``` -------------------------------- ### C_INIT_InitFromCPSnapshot Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_initfromcpsnapshot.mdx C_INIT_InitFromCPSnapshot ```csharp string StrSnapshotSubset { get; set; } ``` -------------------------------- ### Start Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/ceffectdata.mdx Represents the starting point of an effect. ```csharp ref Vector Start { get; } ``` -------------------------------- ### UseNewCode Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_createwithinbox.mdx A flag to indicate the usage of new code implementation. ```csharp ref bool UseNewCode { get; } ``` -------------------------------- ### Unhook (Guid) Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/gameevents/igameeventservice/index.mdx Unhooks a specific event callback using its GUID. ```csharp void Unhook(Guid guid) ``` -------------------------------- ### StartUpdateProperties Method Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/steamapi/steamgameserverinventory.mdx Creates a request to update properties on items. ```csharp public static SteamInventoryUpdateHandle_t StartUpdateProperties() ``` -------------------------------- ### Loading Configuration (SwiftlyS2) Source: https://github.com/swiftly-solution/website/blob/main/content/docs/guides/porting-from-css.mdx Example of loading configuration using the .NET Options pattern with hot-reload in SwiftlyS2. ```csharp // SwiftlyS2 private PluginConfig _config = null!; private void LoadConfiguration() { const string ConfigFileName = "config.json"; const string ConfigSection = "MyPlugin"; // Initialize config file from model (creates file with defaults if not exists) Core.Configuration .InitializeJsonWithModel(ConfigFileName, ConfigSection) // Configure the config source with hot-reload support .Configure(cfg => cfg.AddJsonFile( Core.Configuration.GetConfigPath(ConfigFileName), optional: false, reloadOnChange: true)); // auto-reload on file change // Build service provider with options pattern ServiceCollection services = new(); services.AddSwiftly(Core) .AddOptionsWithValidateOnStart() .BindConfiguration(ConfigSection); var provider = services.BuildServiceProvider(); _config = provider.GetRequiredService>().Value; } ``` -------------------------------- ### Guid Property Definition Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/protobufdefinitions/csvcmsg_stopsound.mdx The C# definition for the Guid property within the CSVCMsg_StopSound interface. ```csharp uint Guid { get; set; } ``` -------------------------------- ### Reverse Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_initfromcpsnapshot.mdx Indicates if the operation is reversed. ```csharp ref bool Reverse { get; } ``` -------------------------------- ### Using Database Connections in Plugins Source: https://github.com/swiftly-solution/website/blob/main/content/docs/guides/porting-from-css.mdx Example of referencing a database connection by name in a plugin configuration and using it. ```csharp // Plugin config references connection by name public sealed class PluginConfig { public string DatabaseConnection { get; set; } = "host"; // name from database.jsonc } // Get connection using the name using var connection = Core.Database.GetConnection(_config.DatabaseConnection); connection.Open(); // Use with Dapper or any ADO.NET approach await connection.ExecuteAsync("SELECT * FROM players WHERE steamid = @SteamId", new { SteamId = steamId }); ``` -------------------------------- ### HintStartSound Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/gameeventdefinitions/eventinstructorserverhintcreate.mdx Specifies the game sound to be played when the hint is activated. This property is of type string. ```csharp string HintStartSound { get; set; } ``` -------------------------------- ### Load Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/protobufdefinitions/cmsggccstrike15_v2_gc2clientinitsystem.mdx Indicates whether the system should be loaded. ```csharp bool Load { get; set; } ``` -------------------------------- ### OnStart Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cpulsecell_outflow_listenforanimgraphtag.mdx Represents the resume point when the operation starts. ```csharp CPulse_ResumePoint OnStart { get; } ``` -------------------------------- ### HintGamepadBinding Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/gameeventdefinitions/eventinstructorserverhintcreate.mdx gamepad bindings to use when use_binding is the onscreen icon ```csharp string HintGamepadBinding { get; set; } ``` -------------------------------- ### Begin Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/feantitunnelprobe_t.mdx Property definition for Begin in FeAntiTunnelProbe_t. ```csharp ref uint Begin { get; } ``` -------------------------------- ### ServerStartTick Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/protobufdefinitions/cdemofileheader.mdx Represents the server start tick of the demo file header. ```csharp int ServerStartTick { get; set; } ``` -------------------------------- ### BindingText Example Usage Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/menus/optionsbase/menuoptionbase.mdx Example of how to use the BindingText property to dynamically update menu option text. ```csharp string myText = "Hello"; option.BindingText = () => myText; myText = "World"; // option.Text now returns "World" // Return null to use fallback Text option.BindingText = () => condition ? playerName : null; ``` -------------------------------- ### NeedInit Field Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/natives/attackerinfo_t.mdx Indicates if initialization is needed. ```csharp public byte NeedInit ``` -------------------------------- ### Generic Get Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/entitykeyvalues.mdx Demonstrates using the generic Get method for retrieving values with type inference. ```csharp int health = keyValues.Get("health"); string name = keyValues.Get("name"); Vector position = keyValues.Get("position"); ``` -------------------------------- ### StartVRDashboard Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/steamapi/steamgameserverutils.mdx Requests SteamUI to create and render its OpenVR dashboard. ```csharp public static void StartVRDashboard() ``` -------------------------------- ### Install Dependencies Source: https://github.com/swiftly-solution/website/blob/main/README.md Commands to install project dependencies and next-themes using npm, pnpm, or yarn. ```bash npm install npm install next-themes # or pnpm install pnpm add next-themes # or yarn install yarn add next-themes ``` -------------------------------- ### ManualSnapshotIndex Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_initfromcpsnapshot.mdx Represents the manual snapshot index. ```csharp CPerParticleFloatInput ManualSnapshotIndex { get; } ``` -------------------------------- ### LoopStart Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cvoicecontainerloopxfade.mdx Represents the start time of the loop. ```csharp ref float LoopStart { get; } ``` -------------------------------- ### AttributeToWrite Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_initfromcpsnapshot.mdx Represents the attribute to write. ```csharp ParticleAttributeIndex_t AttributeToWrite { get; } ``` -------------------------------- ### HintBinding Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/gameeventdefinitions/eventinstructorserverhintcreate.mdx Bindings to use when use_binding is the onscreen icon. ```csharp string HintBinding { get; set; } ``` -------------------------------- ### TStartTime Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/csceneopportunity.mdx Represents the start time of the opportunity. ```csharp GameTime_t TStartTime { get; } ``` -------------------------------- ### Complete Example: Spawning a Logic Relay Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/entitykeyvalues.mdx A comprehensive example demonstrating the creation, configuration, and spawning of a logic_relay entity using CEntityKeyValues. ```csharp public override void Load(bool hotReload) { CBaseEntity relay = Core.EntitySystem.CreateEntityByDesignerName("logic_relay"); using var keyValues = new CEntityKeyValues(); keyValues.SetString("targetname", "sw_logic_relay_main"); keyValues.SetVector("origin", new Vector(0, 0, 64)); keyValues.SetQAngle("angles", new QAngle(0, 0, 0)); keyValues.SetBool("StartDisabled", false); relay.DispatchSpawn(keyValues); Console.WriteLine($"Spawned entity '{relay.DesignerName}' with key values."); } ``` -------------------------------- ### StartPurchase Method Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/steamapi/steamgameserverinventory.mdx Initiates the purchase process for specified item definitions. A SteamInventoryStartPurchaseResult_t callback is posted if Steam can initialize the transaction. A SteamInventoryResultReady_t callback is posted once the purchase is authorized and completed by the user. ```csharp public static SteamAPICall_t StartPurchase(SteamItemDef_t[] pArrayItemDefs, uint[] punArrayQuantity, uint unArrayLength) ``` -------------------------------- ### StartPos Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cinferno.mdx Represents the starting position. ```csharp ref Vector StartPos { get; } ``` -------------------------------- ### Complete Example: Provider Plugin Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/shared-api.mdx Implementation of the Economy API and the provider plugin. ```csharp using MyPlugin.Contracts; public sealed class EconomyApi : IEconomyApi { private readonly Dictionary _balances = new(); public int GetBalance(ulong steamId) { return _balances.TryGetValue(steamId, out int balance) ? balance : 0; } public bool TrySpend(ulong steamId, int amount) { int current = GetBalance(steamId); if (current < amount) { return false; } _balances[steamId] = current - amount; return true; } } public class EconomyPlugin : BasePlugin { private readonly EconomyApi _api = new(); public override void ConfigureSharedInterface(IInterfaceManager interfaceManager) { interfaceManager.AddSharedInterface("Economy.Api.v1", _api); } } ``` -------------------------------- ### Manager Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/services/ipluginconfigurationservice.mdx Gets the configuration root. ```csharp IConfigurationManager Manager { get; } ``` -------------------------------- ### Basic Command Registration Source: https://github.com/swiftly-solution/website/blob/main/content/docs/guides/porting-from-css.mdx Shows how to register basic commands in both frameworks. ```csharp AddCommand("mycommand", "Description", OnMyCommand); ``` ```csharp [Command("mycommand")] public void OnMyCommand(ICommandContext context) { var player = context.Sender; } ``` -------------------------------- ### TransitionSourceOrientation Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cfuncmover.mdx The orientation from which the transition started. ```csharp ref Quaternion TransitionSourceOrientation { get; } ``` -------------------------------- ### SeqStartTime Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cbaseanimgraphcontroller.mdx Represents the start time of a sequence. ```csharp GameTime_t SeqStartTime { get; } ``` -------------------------------- ### MenuOptionBase() Constructor Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/menus/optionsbase/menuoptionbase.mdx Creates an instance of SwiftlyS2.Core.Menus.OptionsBase.MenuOptionBase. ```csharp protected MenuOptionBase() ``` -------------------------------- ### StartSpot Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/natives/cglobalvars.mdx Represents the starting spot. ```csharp public CString StartSpot ``` -------------------------------- ### gameinfo.gi modification Source: https://github.com/swiftly-solution/website/blob/main/content/docs/installation.mdx Add the SwiftlyS2 Loader to your gameinfo.gi file. ```text Game csgo/addons/swiftlys2 ``` -------------------------------- ### OutputMin Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_initialrepulsionvelocity.mdx Represents the minimum output vector. ```csharp ref Vector OutputMin { get; } ``` -------------------------------- ### SumOfAllEdges Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cshatterglassshard.mdx Gets the sum of all edges. ```csharp ref float SumOfAllEdges { get; } ``` -------------------------------- ### StressVelocity Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cshatterglassshard.mdx Gets the stress velocity. ```csharp ref Vector StressVelocity { get; } ``` -------------------------------- ### Creating a Menu (CounterStrikeSharp) Source: https://github.com/swiftly-solution/website/blob/main/content/docs/guides/porting-from-css.mdx Example of creating a chat menu in CounterStrikeSharp. ```csharp var menu = new ChatMenu("Title"); menu.AddMenuOption("Option 1", (p, o) => { }); MenuManager.OpenChatMenu(player, menu); ``` -------------------------------- ### TriggerRadius Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/citemgeneric.mdx Gets the trigger radius. ```csharp ref float TriggerRadius { get; } ``` -------------------------------- ### Build Method Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/menus/imenubuilderapi.mdx Builds the menu and returns the final menu instance. ```csharp IMenuAPI Build() ``` -------------------------------- ### EquipTimer Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/ccsbot.mdx Gets the timer for equipping. ```csharp IntervalTimer EquipTimer { get; } ``` -------------------------------- ### Manifest Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/protobufdefinitions/cmsggccstrike15_v2_gc2clientinitsystem.mdx Represents the manifest string for the system. ```csharp string Manifest { get; set; } ``` -------------------------------- ### Team Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cbaseentity.mdx Gets the team of the entity. ```csharp Team Team { get; set; } ``` -------------------------------- ### GetModel() Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cbasemodelentity.mdx Gets the model of the entity. ```csharp string? GetModel() ``` -------------------------------- ### Update Package References Source: https://github.com/swiftly-solution/website/blob/main/content/docs/guides/porting-from-css.mdx Example of updating the .csproj file to replace CSS references with SwiftlyS2 references. ```xml ``` -------------------------------- ### Name Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/engine/iserversideclientbase.mdx Gets the name of the client. ```csharp string Name { get; set; } ``` -------------------------------- ### StartCP Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_distancetocpinit.mdx A reference to an integer representing the starting control point. ```csharp ref int StartCP { get; } ``` -------------------------------- ### StartPos Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/trace/traceresult.mdx The starting position of the trace. ```csharp public readonly Vector StartPos { get; } ``` -------------------------------- ### PhaseStartTick Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cmapvetopickcontroller.mdx The starting tick of the current phase. ```csharp ref int PhaseStartTick { get; } ``` -------------------------------- ### OutputMin Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_creationnoise.mdx C# property definition for OutputMin. ```csharp ref float OutputMin { get; } ``` -------------------------------- ### HintCaption Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/gameeventdefinitions/eventinstructorserverhintcreate.mdx The hint caption. ```csharp string HintCaption { get; set; } ``` -------------------------------- ### SystemPackage Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/protobufdefinitions/cmsggccstrike15_v2_gc2clientinitsystem.mdx Represents the system package data. ```csharp byte[] SystemPackage { get; set; } ``` -------------------------------- ### TimeRotationStart Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cfuncrotator.mdx The game time when the rotation started. ```csharp GameTime_t TimeRotationStart { get; } ``` -------------------------------- ### OnRotationStarted Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cfuncrotator.mdx Event triggered when rotation is started. ```csharp ref CEntityIOOutput OnRotationStarted { get; } ``` -------------------------------- ### Registering Additional Handler Classes Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/swiftly-core.mdx Example showing how to register an instance of a handler class using Core.Registrator when attributes are used outside the main plugin class. ```csharp public sealed class ChatHandlers { [ClientChatHookHandler] public HookResult OnClientChat(int playerId, string text, bool teamonly) { return HookResult.Continue; } } public override void Load(bool hotReload) { Core.Registrator.Register(new ChatHandlers()); } ``` -------------------------------- ### OnOscillate Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cfuncrotator.mdx Event triggered when oscillation starts. ```csharp ref CEntityIOOutput OnOscillate { get; } ``` -------------------------------- ### InitializeTomlWithModel Method Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/services/ipluginconfigurationservice.mdx Initializes a TOML configuration file with a class as a template. ```csharp IPluginConfigurationService InitializeTomlWithModel(string name, string sectionName) where T : class, new() ``` -------------------------------- ### FadeSizeStartUpdated Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cbarnlight.mdx Updates the fade size start. ```csharp void FadeSizeStartUpdated() ``` -------------------------------- ### Accessing Services Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/native-functions-and-hooks.mdx Demonstrates how to access the Core.GameData and Core.Memory services. ```csharp public override void Load(bool hotReload) { var gameData = Core.GameData; var memory = Core.Memory; } ``` -------------------------------- ### LightStyleStartTime Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cbarnlight.mdx The start time for the light style. ```csharp GameTime_t LightStyleStartTime { get; } ``` -------------------------------- ### Finding Entities (SwiftlyS2) Source: https://github.com/swiftly-solution/website/blob/main/content/docs/guides/porting-from-css.mdx Examples of finding entities using the SwiftlyS2 EntitySystem. ```csharp Core.EntitySystem.GetAllEntities(); // all entities Core.EntitySystem.GetAllEntitiesByClass(); // by class type Core.EntitySystem.GetAllEntitiesByDesignerName("planted_c4"); // by designer name ``` -------------------------------- ### StartOffset Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_op_setcontrolpointtoimpactpoint.mdx The offset from the start of the trace. ```csharp ref float StartOffset { get; } ``` -------------------------------- ### PlaceAlongPath Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_pointlist.mdx Indicates whether points should be placed along the path. ```csharp ref bool PlaceAlongPath { get; } ``` -------------------------------- ### LoadSystem Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/protobufdefinitions/cmsggccstrike15_v2_gc2clientinitsystem.mdx Indicates whether the entire system should be loaded. ```csharp bool LoadSystem { get; set; } ``` -------------------------------- ### StartTime Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/protobufdefinitions/cgamenetworkingui_connectionstate.mdx Represents the start time of the connection. ```csharp uint StartTime { get; set; } ``` -------------------------------- ### StartTick Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/protobufdefinitions/cdemoanimationdata.mdx The tick at which the animation starts. ```csharp int StartTick { get; set; } ``` -------------------------------- ### SampleStart Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cmotiongraphconfig.mdx Represents the starting sample index for the motion graph configuration. ```csharp ref int SampleStart { get; } ``` -------------------------------- ### OnStartupServer Event Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/events/ieventsubscriber.mdx Called when the server is started. ```csharp event EventDelegates.OnStartupServer? OnStartupServer ``` -------------------------------- ### DesiredHitbox Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_sethitboxtoclosest.mdx Specifies the desired hitbox to be used. ```csharp ref int DesiredHitbox { get; } ``` -------------------------------- ### LODSetupIndex Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/aggregatemeshinfo_t.mdx Index for LOD setup. ```csharp ref short LODSetupIndex { get; } ``` -------------------------------- ### GetNumSubscribedItems Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/steamapi/steamgameserverugc.mdx Gets the number of subscribed items. ```csharp public static uint GetNumSubscribedItems(bool bIncludeLocallyDisabled = false) ``` -------------------------------- ### InputMin Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_initialsequencefrommodel.mdx Property definition for InputMin. ```csharp ref float InputMin { get; } ``` -------------------------------- ### GetItemUpdateProgress Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/steamapi/steamgameserverugc.mdx Gets the progress of an item update. ```csharp public static EItemUpdateStatus GetItemUpdateProgress(UGCUpdateHandle_t handle, out ulong punBytesProcessed, out ulong punBytesTotal) ``` -------------------------------- ### Min Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_createwithinbox.mdx Defines the minimum bounds for particle creation within the box. ```csharp CPerParticleVecInput Min { get; } ``` -------------------------------- ### GetPOPList Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/steamapi/steamgameservernetworkingutils.mdx Gets the list of all POP IDs. ```csharp public static int GetPOPList(out SteamNetworkingPOPID list, int nListSz) ``` -------------------------------- ### StartingLocalToWorld Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/perticksettings_t.mdx Represents the starting local to world transformation matrix. Returns a reference to a CTransform. ```csharp ref CTransform StartingLocalToWorld { get; } ``` -------------------------------- ### GetLocalPingLocation Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/steamapi/steamgameservernetworkingutils.mdx Gets the local ping location. ```csharp public static float GetLocalPingLocation(out SteamNetworkPingLocation_t result) ``` -------------------------------- ### GetWinningTeam Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/services/igameservice.mdx Gets the winning team ID. ```csharp int GetWinningTeam() ``` -------------------------------- ### AsProtobuf Method Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/helper/index.mdx Converts a pointer to a protobuf class. ```csharp public static T AsProtobuf(nint ptr, bool manuallyAllocated) where T : ITypedProtobuf ``` -------------------------------- ### HintIconOnscreen Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/gameeventdefinitions/eventinstructorserverhintcreate.mdx the hint icon to use when the hint is onscreen. e.g. "icon_alert_red" ```csharp string HintIconOnscreen { get; set; } ``` -------------------------------- ### SubShardGeneration Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cshatterglassshard.mdx Gets the sub-shard generation count. ```csharp ref int SubShardGeneration { get; } ``` -------------------------------- ### SpawnTemplates Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cpathmoverentityspawner.mdx Gets or sets the spawn templates. ```csharp ISchemaStringFixedArray SpawnTemplates { get; } ``` -------------------------------- ### HintFlags Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/gameeventdefinitions/eventinstructorserverhintcreate.mdx hint flags ```csharp int HintFlags { get; set; } ``` -------------------------------- ### Placeholder Formatting Example Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/translations.mdx Demonstrates using indexed placeholders in translation keys and providing arguments. ```jsonc { "round.win": "{0} won the round in {1} seconds" } ``` ```csharp string text = localizer["round.win", "CT", 42]; ``` -------------------------------- ### SpawnNum Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cpathmoverentityspawner.mdx Gets or sets the number of spawns. ```csharp ref int SpawnNum { get; } ``` -------------------------------- ### Load Method Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/plugins/iplugin.mdx Loads the plugin, with an option for hot reloading. ```csharp void Load(bool hotReload) ``` -------------------------------- ### SpawnIndex Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cpathmoverentityspawner.mdx Gets or sets the spawn index. ```csharp ref int SpawnIndex { get; } ``` -------------------------------- ### KeyData Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/protobufdefinitions/cmsggccstrike15_v2_gc2clientinitsystem.mdx Represents the key data for the system initialization. ```csharp byte[] KeyData { get; set; } ``` -------------------------------- ### Useable Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/citemgeneric.mdx Gets whether the item is usable. ```csharp ref bool Useable { get; } ``` -------------------------------- ### AttributeToRead Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_initfromcpsnapshot.mdx Represents the attribute to read. ```csharp ParticleAttributeIndex_t AttributeToRead { get; } ``` -------------------------------- ### TriggerRadiusSqr Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/citemgeneric.mdx Gets the squared trigger radius. ```csharp ref float TriggerRadiusSqr { get; } ``` -------------------------------- ### TriggerHelper Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/citemgeneric.mdx Gets a handle to the trigger helper. ```csharp ref CHandle TriggerHelper { get; } ``` -------------------------------- ### Initialize TOML with Model Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/configuration.mdx Initializes a TOML configuration file using a C# model. The file is created only if it does not already exist. ```csharp Core.Configuration.InitializeTomlWithModel("database.toml", "Database"); ``` -------------------------------- ### IsRescued Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/chostage.mdx Gets whether the hostage has been rescued. ```csharp ref bool IsRescued { get; } ``` -------------------------------- ### Inherit Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_initialrepulsionvelocity.mdx Indicates whether to inherit properties. ```csharp ref bool Inherit { get; } ``` -------------------------------- ### HostageState Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/chostage.mdx Gets the current state of the hostage. ```csharp ref int HostageState { get; } ``` -------------------------------- ### Random Property Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_initfromcpsnapshot.mdx Indicates if random values are used. ```csharp ref bool Random { get; } ``` -------------------------------- ### HostageResetPosition Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/chostage.mdx Gets the reset position of the hostage. ```csharp ref Vector HostageResetPosition { get; } ``` -------------------------------- ### Option Types Examples Source: https://github.com/swiftly-solution/website/blob/main/content/docs/development/menus.mdx Illustrates the usage of ToggleMenuOption, SliderMenuOption, and InputMenuOption, including setting default values, event handling for value changes, and input validation. ```csharp var toggle = new ToggleMenuOption("Friendly Fire", defaultToggleState: false); toggle.ValueChanged += (sender, args) => { args.Player.PrintToChat($"Friendly Fire: {args.NewValue}"); }; var slider = new SliderMenuOption( text: "Round Time", min: 60f, max: 300f, defaultValue: 120f, step: 30f, totalBars: 8 ); slider.ValueChanged += (sender, args) => { args.Player.PrintToChat($"Round time: {args.NewValue:0}s"); }; var input = new InputMenuOption( text: "Clan Tag", maxLength: 8, validator: value => !string.IsNullOrWhiteSpace(value), defaultValue: "", hintMessage: "Type your clan tag in chat" ); input.ValueChanged += (sender, args) => { args.Player.PrintToChat($"Saved tag: {args.NewValue}"); }; var menu = Core.MenusAPI.CreateBuilder() .Design.SetMenuTitle("Player Preferences") .AddOption(toggle) .AddOption(slider) .AddOption(input) .Build(); ``` -------------------------------- ### RequestEligiblePromoItemDefinitionsIDs(CSteamID) Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/steamapi/steamgameserverinventory.mdx Requests the list of "eligible" promo items that can be manually granted to the given user. These are promo items of type "manual" that won't be granted automatically. ```csharp public static SteamAPICall_t RequestEligiblePromoItemDefinitionsIDs(CSteamID steamID) ``` -------------------------------- ### FollowMoverVelocity Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cfuncmover.mdx Gets the velocity for following the mover. ```csharp ref float FollowMoverVelocity { get; } ``` -------------------------------- ### FollowMoverSpeed Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cfuncmover.mdx Gets the speed for following the mover. ```csharp ref float FollowMoverSpeed { get; } ``` -------------------------------- ### SpeedMin Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/c_init_createwithinspheretransform.mdx Represents the minimum speed for particles. ```csharp CPerParticleFloatInput SpeedMin { get; } ``` -------------------------------- ### FollowMoverRatio Source: https://github.com/swiftly-solution/website/blob/main/content/docs/api/schemadefinitions/cfuncmover.mdx Gets the ratio for following the mover. ```csharp ref float FollowMoverRatio { get; } ```