### RmlUi Getting Started Source: https://docs.altv.mp/articles/rmlui/index Getting started guide for RmlUi, including an introduction and information on nametags and debugging. ```cs RmlUi Getting Started Introduction Nametags Debugging ``` -------------------------------- ### AltV.Net SDK First Steps Source: https://docs.altv.mp/cs/api/AltV.Net.Shared A guide to getting started with the AltV.Net SDK, outlining initial setup and usage. ```cs SDK First Steps ``` -------------------------------- ### AltV.Net SDK First Steps Source: https://docs.altv.mp/cs/api/AltV.Net.Async.Elements.Entities A guide to getting started with the AltV.Net SDK, outlining initial setup and configuration. ```cs SDK First Steps ``` -------------------------------- ### AltV.Net SDK Introduction Source: https://docs.altv.mp/js/api/alt-server Guides for the AltV.Net SDK, covering initial setup, module runtime, resource handling, and event management. ```cs SDK Introduction First Steps Module runtime Module resources Handling events MValues Modules for reference Client Server ``` -------------------------------- ### alt:V JS Module Quickstart Source: https://docs.altv.mp/js/index The quickstart guide for the alt:V JS module helps users create their first server gamemode in JavaScript. It provides a step-by-step approach for beginners. ```javascript console.log('alt:V JS Module Quickstart'); // Create your first server gamemode in JS ``` -------------------------------- ### AltV.Net First Steps Source: https://docs.altv.mp/cs/api/AltV.Net.Shared.Events A guide for beginners to take their first steps with the AltV.Net SDK, covering initial setup and basic concepts. ```markdown ## First Steps 1. Install the AltV.Net SDK. 2. Create a new C# project. 3. Reference the AltV.Net assemblies. ``` -------------------------------- ### Getting Started with JS Resources Source: https://docs.altv.mp/js/articles/index This section guides new developers on setting up alt:V, creating their first JavaScript resource, understanding event handling, and learning about the player object. It serves as an entry point for JS development within the alt:V ecosystem. ```js console.log("Setting up alt:V..."); // Further setup instructions would follow here. ``` ```js console.log("Creating your first JS resource..."); // Resource creation steps would be detailed here. ``` ```js alt.on("playerConnect", (player) => { console.log(`Player ${player.name} connected.`); }); // Example of handling a player connection event. ``` ```js const player = alt.Player.local; console.log(`Player name: ${player.name}`); // Accessing information about the local player. ``` -------------------------------- ### alt:V C# Module Quickstart Source: https://docs.altv.mp/cs/index A guide to creating your first server gamemode in C# using the alt:V C# module. ```cs // Look into this guide on how to create your first server gamemode in C#. ``` -------------------------------- ### AltV.Net SDK Introduction Source: https://docs.altv.mp/cs/api/AltV.Net.Shared.Events Provides an introduction to the AltV.Net SDK, outlining its purpose and how to get started with development. ```markdown # AltV.Net SDK This SDK allows developers to create native extensions and resources for AltV multiplayer. ``` -------------------------------- ### Initial Setup and Testing Source: https://docs.altv.mp/articles/contributing Steps for initial setup and testing of documentation contributions for alt:V. ```cs Initial setup Generating and testing ``` -------------------------------- ### AltV.Net SDK Introduction Source: https://docs.altv.mp/articles/changelogs/upcoming Provides an overview of the AltV.Net SDK, its purpose, and how to get started with developing modifications. ```cs SDK Introduction First Steps Module runtime Module resources Handling events MValues Modules for reference Client Server ``` -------------------------------- ### C# AltV.Net Resource Development Guide Source: https://docs.altv.mp/cs/articles/index This guide outlines the foundational steps for developing C# resources within the AltV.Net framework. It details the process from initial setup and resource creation to writing custom scripts and handling various event types. ```cs /* This is the documentation for getting started developing c# resources. Read Setup for setting up the basics and getting ready for work. Read Create Resource for creating a c# resource. Read Create Script to learn the first steps about how to write code for your own resource. Read Events for an introduction about handling alt:V standard events. Read Custom Events to understand how custom events are emitted and handled. Read Entity factories to get an understanding about how to handle meta-like data more efficient. Read Checkpoints to learn about checkpoints. */ ``` -------------------------------- ### Setup AltV.Net Interactions Source: https://docs.altv.mp/cs/articles/getting-started/interactions Demonstrates how to initialize and dispose of the AltV.Net interactions package within a resource's lifecycle. This involves calling AltInteractions.Init() on start and AltInteractions.Dispose() on stop. ```cs public class MyResource: Resource { public override void OnStart() { // (some code from you) AltInteractions.Init(); // (some code from you) } public override void OnStop() { // (some code from you) AltInteractions.Dispose(); // (some code from you) } } ``` -------------------------------- ### AltV.Net C# Example Usage Source: https://docs.altv.mp/js/articles/snippets/prototyping Illustrates example usage within the AltV.Net C# framework. This snippet shows how to interact with game entities and potentially utilize prototyping features. Ensure correct setup and resource loading for proper functionality. ```cs using AltV.Net; using AltV.Net.Elements.Entities; namespace MyResource { public class MyResource : Resource { public override void OnStart() { Alt.Log("MyResource started!"); // Example: Attaching a handler to player connect event Alt.OnPlayerConnect += OnPlayerConnect; } public override void OnStop() { Alt.Log("MyResource stopped!"); Alt.OnPlayerConnect -= OnPlayerConnect; } private void OnPlayerConnect(IPlayer player, string reason) { Alt.Log("Player connected: " + player.Name); // Example of setting metadata (similar to prototyping) player.SetMeta("custom_data", "hello_world"); } } } ``` -------------------------------- ### C++ Module Setup for AltV.Net SDK Source: https://docs.altv.mp/sdk/first-steps This snippet demonstrates the basic setup required for a C++ module in the AltV.Net SDK. It includes setting the necessary define for the AltV API and including the main SDK header file. Ensure your compiler supports C++17 and the output is a 64-bit DLL. ```cpp #define ALT_SERVER_API #include "cpp-sdk/SDK.h" ``` -------------------------------- ### Alt.CreateVehicle Usage Example Source: https://docs.altv.mp/cs/articles/getting-started/vehicle-create This example demonstrates the usage of the Alt.CreateVehicle function, showing how to spawn a vehicle with a specific model, position, and rotation. ```cs //Parameter : (uint model, Position pos, Rotation rotation) Alt.CreateVehicle(AltV.Net.Enums.VehicleModel.Adder, new Position(0, 0, 0), new Rotation(0,0,0)); ``` -------------------------------- ### Refactor Installer, Uninstaller, and Launcher Source: https://docs.altv.mp/articles/changelogs/14_0 The installer and uninstaller have been reworked, along with general improvements to the launcher. CLI arguments for debug, branch, and skipprocessconfirmation are also added. -------------------------------- ### AltV.Net SDK Introduction Source: https://docs.altv.mp/cs/api/AltV.Net.Enums An introduction to the AltV.Net SDK, covering its purpose and initial setup. ```cs SDK Introduction First Steps ``` -------------------------------- ### alt:V Direct Connect Protocol Examples Source: https://docs.altv.mp/articles/connectprotocol Provides examples of how to format connection addresses and passwords for the alt:V Direct Connect Protocol, demonstrating URL encoding for various scenarios. ```URL altv://connect/my.cdn.server%3A80 ``` ```URL altv://connect/http%3A%2F%2Fmy.cdn.server ``` ```URL altv://connect/%5B%3A%3A1%5D%3A1234?password=test ``` -------------------------------- ### Example altv.toml Configuration Source: https://docs.altv.mp/articles/configs/client Provides an example of the altv.toml file, showcasing common client configuration settings. This file is essential for customizing the AltV client's behavior and connection parameters. ```toml # Example altv.toml file # Specifies the branch to use (e.g., "beta", "alpha", "dev") branch = "beta" # Path to the GTA V installation directory gtaPath = "C:\\Program Files\\Rockstar Games\\Grand Theft Auto V\\" # Sets the preferred language for the client language = "en" # Enables or disables hardware accelerated rendering useResourceCache = true # Sets the maximum number of FPS maxFps = 144 # Enables or disables the debug console useConsole = true # Sets the audio output device audioOutput = "Default" # Sets the audio input device audioInput = "Default" # Enables or disables voice chat useVoice = true # Sets the voice chat volume voiceVolume = 0.8 # Sets the voice chat input device voiceInput = "Default" # Sets the voice chat output device voiceOutput = "Default" # Enables or disables the minimap useMinimap = true # Sets the minimap scale minimapScale = 1.0 # Sets the minimap position minimapPosition = "top-right" # Enables or disables the HUD useHud = true # Sets the HUD scale hudScale = 1.0 # Sets the HUD position hudPosition = "bottom-right" # Enables or disables the chat useChat = true # Sets the chat scale chatScale = 1.0 # Sets the chat position chatPosition = "bottom-left" # Enables or disables the notifications useNotifications = true # Sets the notifications scale notificationsScale = 1.0 # Sets the notifications position notificationsPosition = "top-left" # Enables or disables the scoreboard useScoreboard = true # Sets the scoreboard scale scoreboardScale = 1.0 # Sets the scoreboard position scoreboardPosition = "top-right" # Enables or disables the player list usePlayerList = true # Sets the player list scale playerListScale = 1.0 # Sets the player list position playerListPosition = "top-right" # Enables or disables the vehicle list useVehicleList = true # Sets the vehicle list scale vehicleListScale = 1.0 # Sets the vehicle list position vehicleListPosition = "top-right" # Enables or disables the weapon list useWeaponList = true # Sets the weapon list scale weaponListScale = 1.0 # Sets the weapon list position weaponListPosition = "top-right" # Enables or disables the inventory useInventory = true # Sets the inventory scale inventoryScale = 1.0 # Sets the inventory position inventoryPosition = "bottom-right" # Enables or disables the map useMap = true # Sets the map scale mapScale = 1.0 # Sets the map position mapPosition = "top-left" # Enables or disables the radar useRadar = true # Sets the radar scale radarScale = 1.0 # Sets the radar position radarPosition = "top-left" # Enables or disables the compass useCompass = true # Sets the compass scale compassScale = 1.0 # Sets the compass position compassPosition = "top-left" # Enables or disables the clock useClock = true # Sets the clock scale clockScale = 1.0 # Sets the clock position clockPosition = "top-left" # Enables or disables the date useDate = true # Sets the date scale dateScale = 1.0 # Sets the date position datePosition = "top-left" # Enables or disables the weather useWeather = true # Sets the weather scale weatherScale = 1.0 # Sets the weather position weatherPosition = "top-left" # Enables or disables the time useTime = true # Sets the time scale timeScale = 1.0 # Sets the time position timePosition = "top-left" # Enables or disables the notifications useNotifications = true # Sets the notifications scale notificationsScale = 1.0 # Sets the notifications position notificationsPosition = "top-left" # Enables or disables the chat useChat = true # Sets the chat scale chatScale = 1.0 # Sets the chat position chatPosition = "bottom-left" # Enables or disables the minimap useMinimap = true # Sets the minimap scale minimapScale = 1.0 # Sets the minimap position minimapPosition = "top-right" # Enables or disables the HUD useHud = true # Sets the HUD scale hudScale = 1.0 # Sets the HUD position hudPosition = "bottom-right" # Enables or disables the scoreboard useScoreboard = true # Sets the scoreboard scale scoreboardScale = 1.0 # Sets the scoreboard position scoreboardPosition = "top-right" # Enables or disables the player list usePlayerList = true # Sets the player list scale playerListScale = 1.0 # Sets the player list position playerListPosition = "top-right" # Enables or disables the vehicle list useVehicleList = true # Sets the vehicle list scale vehicleListScale = 1.0 # Sets the vehicle list position vehicleListPosition = "top-right" # Enables or disables the weapon list useWeaponList = true # Sets the weapon list scale weaponListScale = 1.0 # Sets the weapon list position weaponListPosition = "top-right" # Enables or disables the inventory useInventory = true # Sets the inventory scale inventoryScale = 1.0 # Sets the inventory position inventoryPosition = "bottom-right" # Enables or disables the map useMap = true # Sets the map scale mapScale = 1.0 # Sets the map position mapPosition = "top-left" # Enables or disables the radar useRadar = true # Sets the radar scale radarScale = 1.0 # Sets the radar position radarPosition = "top-left" # Enables or disables the compass useCompass = true # Sets the compass scale compassScale = 1.0 # Sets the compass position compassPosition = "top-left" # Enables or disables the clock useClock = true # Sets the clock scale clockScale = 1.0 # Sets the clock position clockPosition = "top-left" # Enables or disables the date useDate = true # Sets the date scale dateScale = 1.0 # Sets the date position datePosition = "top-left" # Enables or disables the weather useWeather = true # Sets the weather scale weatherScale = 1.0 # Sets the weather position weatherPosition = "top-left" # Enables or disables the time useTime = true # Sets the time scale timeScale = 1.0 # Sets the time position timePosition = "top-left" ``` -------------------------------- ### OnStart() - altv_mp Source: https://docs.altv.mp/cs/api/AltV.Net.Client Abstract method to be implemented for starting the resource. This is called when the resource is initialized. ```csharp public abstract void OnStart() ``` -------------------------------- ### AltV.Net Utils Example Source: https://docs.altv.mp/js/articles/events/index Demonstrates the general Utils class for various helper functions. ```cs public static class Utils { // General utility methods } ``` -------------------------------- ### Install all alt:V TypeScript types with npm Source: https://docs.altv.mp/js/articles/create-your-first-resource Installs all available TypeScript type definitions for alt:V (client, server, shared, natives, webview) using npm. ```bash # Combined # For usage with npm npm i -D @altv/types-shared @altv/types-client @altv/types-natives @altv/types-webview @altv/types-shared @altv/types-server ``` -------------------------------- ### JavaScript Resource Type Source: https://docs.altv.mp/articles/resources This resource type allows developers to write game scripts using JavaScript for both server-side and client-side operations within the alt:V framework. Refer to the 'Getting Started' guide for more details. ```js /* * This is a JavaScript resource for alt:V. * You can write server-side and client-side game scripts here. * For more information, see the alt:V Getting Started guide. */ // Example server-side code: console.log('Server-side JavaScript resource loaded.'); // Example client-side code: alt.on('connectionReady', () => { console.log('Client-side JavaScript resource loaded.'); }); ``` -------------------------------- ### Get or Set Player's Dimension Source: https://docs.altv.mp/js/articles/player/server-player-props Allows getting or setting the player's current dimension, which is an INT32 value. Includes examples for unique player instances. ```javascript const currentDimension = player.dimension; player.dimension = 1; // If you need a unique instance per player join. This is a decent way to handle it. // Just remember to set it back to zero after you do whatever you need to do in a unique dimension. player.dimension = player.id; ``` -------------------------------- ### AltV.Net SDK Introduction Source: https://docs.altv.mp/articles/rmlui/index Introduction to the AltV.Net SDK, covering first steps and module runtime. ```cs SDK Introduction First Steps Module runtime ``` -------------------------------- ### AltV Module SDK Introduction Source: https://docs.altv.mp/sdk/introduction Provides an introduction to the alt:V Module SDK, covering requirements, basic usage, and how to integrate with C or C-compatible languages. ```cpp #include int main() { std::cout << "Welcome to the alt:V C++ Module SDK!" << std::endl; // Your module code here return 0; } ``` -------------------------------- ### Install AltV.Net Entity Sync NuGet Packages Source: https://docs.altv.mp/cs/articles/getting-started/entity-sync This snippet shows how to install the core AltV.Net Entity Sync package and the optional ServerEvent package using NuGet. Ensure both packages are updated to their latest versions for optimal functionality. ```csharp Install-Package AltV.Net.EntitySync Install-Package AltV.Net.EntitySync.ServerEvent ``` -------------------------------- ### AltV.Net SDK Introduction Source: https://docs.altv.mp/gta/articles/references/dlcs Provides an introduction to the AltV.Net SDK, covering first steps and module runtime. ```markdown SDK Introduction First Steps Module runtime Module resources Handling events MValues Modules for reference Client Server ``` -------------------------------- ### AltV.Net SDK Introduction Source: https://docs.altv.mp/gta/articles/references/game-files Provides an introduction to the AltV.Net SDK, covering first steps, module runtime, resource handling, and event management. ```markdown SDK Introduction First Steps Module runtime Module resources Handling events MValues Modules for reference Client Server ``` -------------------------------- ### Get Vehicle Mod Source: https://docs.altv.mp/cs/api/AltV.Net.Async.Elements.Entities Retrieves a specific modification installed on the vehicle. The method requires a category ID and returns the modification ID as a byte. ```csharp public byte GetMod(byte category) ``` -------------------------------- ### AltV.Net SDK Introduction Source: https://docs.altv.mp/cs/api/AltV.Net.Shared An introduction to the AltV.Net SDK, covering its purpose and basic concepts. ```cs SDK Introduction ``` -------------------------------- ### Get Player Name and Kick Source: https://docs.altv.mp/js/articles/player/server-player-props Retrieves the player's current name, which is set in their options. This example demonstrates kicking a player if their name is 'stuyk'. ```javascript alt.on('playerConnect', handleConnect); function handleConnect(player) { if (player.name.toLowerCase() === 'stuyk') { player.kick(`Stupid name.`); } } ``` -------------------------------- ### Setup alt:V Server with JS Module Source: https://docs.altv.mp/js/articles/setup This snippet outlines the process of setting up an alt:V server using the JavaScript module. It covers essential requirements like NodeJS, a code editor, command prompt knowledge, VC Redist, and OS compatibility (Windows/Linux). It also touches upon obtaining server files and running the server through various command-line tools. ```js ## Requirements * Latest Version of NodeJS * A Code Editor (Visual Studio Code, Sublime Text etc.) * Basic knowledge of command prompts * VC Redist Latest Version installed * Windows 10+ or Linux (For running the server) * On Linux you need the package libatomic1 `apt-get install libatomic1` ``` -------------------------------- ### setSyncedMeta Source: https://docs.altv.mp/js/articles/player/server-player-funcs Sets synced meta data on a player entity, accessible server-side and client-side regardless of streaming range. Includes examples for setting, checking, getting, and deleting synced meta. ```javascript // Set the player's meta. player.setSyncedMeta('ping', player.ip); // key, value // Check if the meta exists. if (player.hasSyncedMeta('ping')) { // <--- Usage // Get the meta from the player. const currentCash = player.getSyncedMeta('ping'); // key // Delete the meta. player.deleteSyncedMeta('ping'); // key } ``` -------------------------------- ### Get Player's IP Address Source: https://docs.altv.mp/js/articles/player/server-player-props Retrieves the player's IP address, often an IPv4 address converted to IPv6 format. Includes an example for local host detection. ```javascript alt.on('playerConnect', handleConnect); function handleConnect(player) { if (player.ip === `::ffff:127.0.0.1`) { alt.log(`${player.name} has joined from local host.`); } } ``` -------------------------------- ### Select Server Files Source: https://docs.altv.mp/js/articles/setup Specifies the essential components to download for an alt:V server, including data files, JS modules, sample configuration, and example resource packs. C# modules are optional. ```bash [x] Data Files [x] JS Module [ ] C# Module [x] Sample Config File [x] Example Resource Pack ``` -------------------------------- ### Set or Get Player's Current Weapon Source: https://docs.altv.mp/js/articles/player/server-player-props Allows setting or retrieving the player's currently equipped weapon using its hash. Includes an example of checking the current weapon. ```javascript player.currentWeapon = alt.hash('weapon_pistol'); // 0x1B06D571 if (player.currentWeapon === 0x1b06d571) { console.log(`Player has a pistol equipped.`); } ``` -------------------------------- ### Get Player Auth Token - JavaScript Source: https://docs.altv.mp/js/articles/player/server-player-props Shows how to retrieve a player's authentication token, which was used in early authentication implementations. This example logs the token or kicks the player if it's not found. ```js alt.on('playerConnect', handleConnect); function handleConnect(player) { if (!player.authToken) { player.kick(`No Auth Token Found`); return; } alt.log(`${player.name}'s authToken is ${authToken}`); } ``` -------------------------------- ### AltV.Net Modules Reference Source: https://docs.altv.mp/cs/api/AltV.Net.Shared A reference guide to modules available within the AltV.Net SDK. ```cs SDK Modules for reference ``` -------------------------------- ### Setup Async Resource in AltV.Net Source: https://docs.altv.mp/cs/articles/getting-started/async Demonstrates the necessary steps to set up an asynchronous resource in AltV.Net using C#. This involves adding the AltV.Net.Async NuGet package, inheriting the resource class from AsyncResource, and configuring the base constructor. ```cs public class MyResource : AsyncResource { public MyResource() : base(true) { // Constructor logic } // Other resource methods } ``` -------------------------------- ### Start AltV Trace Recording Source: https://docs.altv.mp/cs/articles/getting-started/trace Initiates the recording of a trace file using the AltTrace API. The trace file will be saved in the altV server directory. Ensure the AltV.Net nuget package is installed. ```csharp AltTrace.Start("traceFileName"); ``` -------------------------------- ### AltV.Net Shared CSharp Resource Impl Example Source: https://docs.altv.mp/js/articles/events/index Demonstrates the implementation of a C# resource for AltV.Net. ```cs public interface ISharedCSharpResourceImpl { // C# resource implementation details } ``` -------------------------------- ### alt:V JavaScript API - Client-side Input and Keybinds Source: https://docs.altv.mp/cs/articles/getting-started/resource-initialization-order Documentation for client-side input handling in alt:V, covering IInputDevice, KeyCode, and the Utils.Keybind utility for managing key bindings. ```JavaScript interface IInputDevice {} enum KeyCode {} class Utils { static Keybind {} } ``` -------------------------------- ### C# Resource Type Source: https://docs.altv.mp/articles/resources This resource type enables the use of C# for server-side game scripting and JavaScript for client-side scripting within the alt:V environment. Consult the 'Getting Started' documentation for comprehensive instructions. ```csharp /* * This is a C# resource for alt:V. * Use C# for server-side scripting and JavaScript for client-side. * Refer to the alt:V Getting Started guide for details. */ using AltV.Net; using AltV.Net.Resources.Chat.Api; namespace MyCSharpResource { public class MyResource : Resource { public MyResource(IAltServer server) : base(server) { } public override void OnStart() { Alt.Log("C# resource started."); // Register chat commands or other server-side logic here } public override void OnStop() { Alt.Log("C# resource stopped."); } } } ``` -------------------------------- ### Integrate AltV Trace Recording with Server Commands Source: https://docs.altv.mp/cs/articles/getting-started/trace Provides a comprehensive example of integrating trace file recording with server-side commands. It includes commands to start, stop, and check the size of trace files, utilizing callbacks for size updates. Requires the AltV.Net nuget package. ```csharp long currentTraceSize = 0; AltTrace.OnTraceFileSizeChange += size => { currentTraceSize = size; }; Alt.OnConsoleCommand += (name, args) => { switch (name) { case "trace_start": if (args.Length != 1) { Console.WriteLine("trace_start {name}"); return; } AltTrace.Start(args[0]); break; case "trace_stop": AltTrace.Stop(); break; case "trace_size": Console.WriteLine("trace file size: " + currentTraceSize + " bytes"); break; } }; ``` -------------------------------- ### AltV.Net SDK Introduction Source: https://docs.altv.mp/cs/api/AltV.Net.Async.Elements.Entities An introduction to the AltV.Net SDK, covering its purpose and basic usage. ```cs SDK Introduction ``` -------------------------------- ### AltV C#: Set, Check, Get, Delete Local Meta Source: https://docs.altv.mp/articles/meta_data Provides C# examples for managing player local meta data in AltV. This includes setting, checking existence, retrieving values (with type specification), and deleting meta, all within the context of a player connection event. ```csharp Alt.OnPlayerConnect += (player, reason) => { // Set a player local meta (set by server, synced to server & client, cross-resource) with a given key and value player.SetLocalMetaData("username", player.Name); // Check if the local meta is set and log the result if (player.HasLocalMetaData("username")) { Alt.Log("Meta is set"); } else { Alt.Log("Meta isn't set"); } // Fetch and save the value of the local meta // When using C# it is required to pass the type of the meta value var valueIsFetched = player.GetLocalMetaData("username", out var metaData); // Delete the meta player.DeleteLocalMetaData("username"); }; ``` -------------------------------- ### alt:V JavaScript Snippets - Prototyping Source: https://docs.altv.mp/cs/articles/getting-started/setup Example snippet illustrating prototyping concepts in alt:V JavaScript. ```JavaScript // Prototyping example Object.prototype.customMethod = function() { /* ... */ }; ``` -------------------------------- ### Get and Set Player Position Source: https://docs.altv.mp/js/articles/player/server-player-props Allows getting or setting the player's current position. When getting, use a spread operator to make the position modifiable. The position can be set using an object or an alt.Vector3. ```javascript const currentPos = { ...player.pos }; currentPos.x += 1; // Teleport them under the map. player.pos = { x: 0, y: 0, z: 0 }; // Create a Vector3 with the alt function. player.pos = new alt.Vector3(0, 0, 0); ``` -------------------------------- ### alt:V JavaScript API - Client-side Input and Keybinds Source: https://docs.altv.mp/cs/articles/getting-started/setup Documentation for client-side input handling in alt:V, covering IInputDevice, KeyCode, and the Utils.Keybind utility for managing key bindings. ```JavaScript interface IInputDevice {} enum KeyCode {} class Utils { static Keybind {} } ``` -------------------------------- ### altv_mp: Get Voice Connection State Source: https://docs.altv.mp/cs/api/AltV.Net.Shared Gets the current state of the voice connection. This function returns the VoiceConnectionState. ```C# public VoiceConnectionState GetVoiceConnectionState() ``` -------------------------------- ### alt:V Server Entry Point (altMain) Source: https://docs.altv.mp/sdk/first-steps The `altMain` function is the server-side entry point for alt:V modules. It receives the core instance, sets it for the SDK, registers a script runtime, and logs a success message. It returns a boolean indicating successful loading. ```cpp // The 'EXPORT' macro is defined by the SDK // It is needed so the alt:V core can call this function EXPORT bool altMain(alt::ICore* core) { // Important! Sets the core for the SDK to the received instance, so you can interact with the server or client alt::ICore::SetInstance(core); // Pseudocode of creating a runtime, // how to create your own runtime will be explained in another article auto runtime = new MyRuntime(); // Register the script runtime // The first argument is the 'type' for your module, // that needs to be specified in the resource.cfg // The second argument is a pointer to your runtime instance core->RegisterScriptRuntime("myModule", runtime); // Logs an info message to the console core->LogInfo("Loaded my module!"); // Return true to indicate that the module loaded successfully return true; } ``` -------------------------------- ### Example Bytecode Compilation Log Source: https://docs.altv.mp/articles/bytecode_module This is an example log message indicating that a file has been successfully converted to bytecode by the module. ```log Converted file to bytecode: path/file.js ``` -------------------------------- ### alt:V JavaScript Snippets - Help Text Source: https://docs.altv.mp/cs/articles/getting-started/setup Example snippet for displaying help text in alt:V. ```JavaScript // Help text display snippet // Example: Show help text for a specific action ``` -------------------------------- ### Get CSharp Implementation Source: https://docs.altv.mp/cs/api/AltV.Net.CApi.Libraries Delegate to get the C# implementation details for a resource. This is crucial for C# specific resource handling. ```C# public delegate* unmanaged[Cdecl] Resource_GetCSharpImpl { get; } ``` -------------------------------- ### Start Timer (TypeScript) Source: https://docs.altv.mp/js/api/alt-client Starts a named timer. This function is typically used in conjunction with timeEnd to measure execution duration. ```typescript time(timerName: string): void ``` -------------------------------- ### Example Resource Structure Source: https://docs.altv.mp/js/articles/create-your-first-resource Defines the standard file and folder organization for a new alt:V resource, including client-side, server-side, and configuration files. ```text This is the name of your resource: example/ Here go the Client-side Files: example/client/ Here go the Server-side Files: example/server/ Here go the configuration & information: example/resource.toml ``` -------------------------------- ### Get Voice Non-Spatial Volume Source: https://docs.altv.mp/js/api/alt-client Gets the non-spatial audio volume for a player. Takes the player's ID and returns the volume. ```typescript getVoiceNonSpatialVolume(player: number): number ``` -------------------------------- ### Custom Launcher Samples (C#) Source: https://docs.altv.mp/articles/customlauncher Provides examples of customizations available for the AltV custom launcher, including background images and RSS feed integration. ```cs // Examples of custom launcher customizations: // - Launcher background: Setting a custom background image for the launcher. // - Interface background and RSS feed: Customizing the UI background and integrating an RSS feed. // - Loading screen: Customizing the loading screen displayed when connecting to a server. // - Activate the skin: Enabling server-specific branding and visual elements. ``` -------------------------------- ### Get Pool Count Source: https://docs.altv.mp/js/api/alt-client Gets the number of entities within a specific pool. Takes the pool name as a string and returns the count. ```typescript getPoolCount(poolName: string): number ``` -------------------------------- ### Get Resource Implementation Source: https://docs.altv.mp/cs/api/AltV.Net.CApi.Libraries Delegate to get the core implementation pointer for a resource. Used for interacting with the resource's native code. ```C# public delegate* unmanaged[Cdecl] Resource_GetImpl { get; } ``` -------------------------------- ### Example JSON Data Source: https://docs.altv.mp/js/articles/import-assertions This is a sample JSON file structure used in the dynamic import examples, containing basic key-value pairs. ```json { "name": "John Doe", "age": "42" } ``` -------------------------------- ### AltV.Net C# Module Server Structure Source: https://docs.altv.mp/cs/articles/getting-started/setup This snippet illustrates the expected file structure for an AltV.Net C# server setup. It shows the placement of the C# module DLL, host files, and server configuration. ```text modules/ └── csharp-module.dll resources/ AltV.Net.Host.dll AltV.Net.Host.runtimeconfig.json server.toml altv-server.exe (altv-server on linux) ``` -------------------------------- ### Get and Set Player Rotation Source: https://docs.altv.mp/js/articles/player/server-player-props Enables getting or setting the player's current rotation. The rotation can be logged or set using an alt.Vector3. ```javascript // Get and log current player rotation. alt.log(player.rot); // Set player rotation to zero. player.rot = new alt.Vector3(0, 0, 0); ``` -------------------------------- ### Get Resource Exports Count Source: https://docs.altv.mp/cs/api/AltV.Net.CApi.Libraries Delegate to get the total number of exports available in a resource. Useful for pre-allocating memory for export arrays. ```C# public delegate* unmanaged[Cdecl] Resource_GetExportsCount { get; } ``` -------------------------------- ### alt:V JavaScript API - Client-side Input and Keybinds Source: https://docs.altv.mp/cs/articles/getting-started/create-script Documentation for client-side input handling in alt:V, covering IInputDevice, KeyCode, and the Utils.Keybind utility for managing key bindings. ```JavaScript interface IInputDevice {} enum KeyCode {} class Utils { static Keybind {} } ``` -------------------------------- ### Get Resource Dependencies Size Source: https://docs.altv.mp/cs/api/AltV.Net.CApi.Libraries Delegate to get the number of resources that a given resource depends on. Provides size information for dependency arrays. ```C# public delegate* unmanaged[Cdecl] Resource_GetDependenciesSize { get; } ``` -------------------------------- ### Get Resource Dependants Size Source: https://docs.altv.mp/cs/api/AltV.Net.CApi.Libraries Delegate to get the number of resources that depend on a given resource. Provides size information for dependency arrays. ```C# public delegate* unmanaged[Cdecl] Resource_GetDependantsSize { get; } ``` -------------------------------- ### alt:V C# Module Overview Source: https://docs.altv.mp/cs/index Familiarize yourself with the alt:V C# module API, learn how to implement and empower your applications with examples, and contribute to the module's maintenance. ```cs /* Familiarise with API Get to know how to implement or empower your applications with our API. Learn by examples Gain knowledge from dedicated articles on how to utilise our API. Contribute Learn and help by taking part in continuous maintenance of this module. */ ``` -------------------------------- ### alt:V JavaScript Snippets - Prototyping Source: https://docs.altv.mp/cs/articles/getting-started/resource-initialization-order Example snippet illustrating prototyping concepts in alt:V JavaScript. ```JavaScript // Prototyping example Object.prototype.customMethod = function() { /* ... */ }; ``` -------------------------------- ### altv_mp: Get Wheel Track Width Source: https://docs.altv.mp/cs/api/AltV.Net.Client.Elements.Interfaces Gets the track width of a specific wheel. Track width influences stability and cornering performance. ```C# float GetWheelTrackWidth(byte wheel) ``` -------------------------------- ### Get Player's Health Source: https://docs.altv.mp/js/articles/player/server-player-props Allows getting or setting the player's current health. Each model has a different health range, with a maximum of 8191. ```javascript const currentHealth = player.health; player.health += 10; // Kill the player. player.health = 0; ``` -------------------------------- ### alt:V JavaScript API - Client-side Input and Keybinds Source: https://docs.altv.mp/cs/articles/getting-started/vehicle-create Documentation for client-side input handling in alt:V, covering IInputDevice, KeyCode, and the Utils.Keybind utility for managing key bindings. ```JavaScript interface IInputDevice {} enum KeyCode {} class Utils { static Keybind {} } ``` -------------------------------- ### Initialize npm or yarn project Source: https://docs.altv.mp/js/articles/create-your-first-resource Commands to initialize a new Node.js project using either npm or yarn. This creates a `package.json` file essential for managing project dependencies and configurations. ```bash # For usage with npm npm init # For usage with yarn yarn init ``` -------------------------------- ### altv_mp: Get Wheel Tyre Width Source: https://docs.altv.mp/cs/api/AltV.Net.Client.Elements.Interfaces Gets the width of the tire on a specific wheel. Tire width impacts grip, rolling resistance, and appearance. ```C# float GetWheelTyreWidth(byte wheel) ``` -------------------------------- ### altv_mp: Get Wheel Rim Radius Source: https://docs.altv.mp/cs/api/AltV.Net.Client.Elements.Interfaces Gets the radius of the wheel's rim. This value is important for accurate tire fitment and visual representation. ```C# float GetWheelRimRadius(byte wheel) ``` -------------------------------- ### Resource Initialization with Constructor Dependencies in C# Source: https://docs.altv.mp/cs/articles/getting-started/resource-initialization-order Shows a C# example of a resource class that handles constructor dependencies. It stores a custom value in a class variable and uses it in both the player factory and the OnStart method, illustrating how to manage shared initialization values. ```csharp class MyResource : Resource { private string mySecret; public MyResource() { mySecret = "1234"; } public override IEntityFactory GetPlayerFactory() { return new MyPlayerFactory(mySecret); } public override OnStart() { // we could need our secret also here new AnotherComponent(mySecret); } public override OnStop() {} } ``` -------------------------------- ### Example JSON Data for Import Assertion Source: https://docs.altv.mp/js/articles/import-assertions Provides an example JSON file structure that can be imported using the 'json' type import assertion in AltV.Net. ```json { "name": "John Doe", "age": "42" } ``` -------------------------------- ### Publish Project with .NET CLI Source: https://docs.altv.mp/cs/articles/getting-started/create-resource Command to publish a .NET project using the .NET CLI. Publishing creates a self-contained deployment that includes all necessary dependencies. ```bash dotnet publish ``` -------------------------------- ### alt:V JavaScript API - Client-side Input and Keybinds Source: https://docs.altv.mp/sdk/creating-runtime Documentation for client-side input handling in alt:V, covering IInputDevice, KeyCode, and the Utils.Keybind utility for managing key bindings. ```JavaScript interface IInputDevice {} enum KeyCode {} class Utils { static Keybind {} } ``` -------------------------------- ### Get ConfigNode by Index (C#) Source: https://docs.altv.mp/cs/api/AltV.Net.Shared.Elements.Data A method to explicitly get a nested ConfigNode using an integer index. It mirrors the indexer functionality for direct method calls. ```csharp public ConfigNode Get(int index) ``` -------------------------------- ### alt:V JavaScript Snippets - Markers Source: https://docs.altv.mp/cs/articles/getting-started/setup Example snippet for creating and managing markers in alt:V. ```JavaScript // Marker creation snippet const marker = new alt.Marker(1, new alt.Vector3(0, 0, 0), { model: 1 }); ``` -------------------------------- ### altv_mp: Get Wheel Camber Source: https://docs.altv.mp/cs/api/AltV.Net.Client.Elements.Interfaces Gets the camber angle of a specific wheel. Camber affects tire wear and handling. Requires the wheel index as input. ```C# float GetWheelCamber(byte wheel) ``` -------------------------------- ### alt:V JavaScript API - Client-side Input and Keybinds Source: https://docs.altv.mp/cs/articles/getting-started/voice Documentation for client-side input handling in alt:V, covering IInputDevice, KeyCode, and the Utils.Keybind utility for managing key bindings. ```JavaScript interface IInputDevice {} enum KeyCode {} class Utils { static Keybind {} } ``` -------------------------------- ### alt:V JavaScript API - Client-side Input and Keybinds Source: https://docs.altv.mp/cs/articles/getting-started/resource-communication Documentation for client-side input handling in alt:V, covering IInputDevice, KeyCode, and the Utils.Keybind utility for managing key bindings. ```JavaScript interface IInputDevice {} enum KeyCode {} class Utils { static Keybind {} } ``` -------------------------------- ### Get ConfigNode by Key (C#) Source: https://docs.altv.mp/cs/api/AltV.Net.Shared.Elements.Data A method to explicitly get a nested ConfigNode using a string key. This provides an alternative to the indexer for accessing configuration values by name. ```csharp public ConfigNode Get(string key) ``` -------------------------------- ### alt:V JavaScript API - Client-side Input and Keybinds Source: https://docs.altv.mp/cs/articles/getting-started/interactions Documentation for client-side input handling in alt:V, covering IInputDevice, KeyCode, and the Utils.Keybind utility for managing key bindings. ```JavaScript interface IInputDevice {} enum KeyCode {} class Utils { static Keybind {} } ``` -------------------------------- ### AltV MP: Get Position Delegate Source: https://docs.altv.mp/cs/api/AltV.Net.CApi.Libraries This C# delegate is used to get the position of a WorldObject. It takes an IntPtr for the WorldObject and a pointer to a Vector3 structure to store the position. ```C# public delegate* unmanaged[Cdecl] WorldObject_GetPosition { get; } ``` -------------------------------- ### Get Server Time (JS/C#) Source: https://docs.altv.mp/articles/changelogs/index Retrieves the current server time. This method is accessible in both JavaScript and C# environments, providing a consistent way to get time information. ```JS alt.getServerTime() ``` ```C# alt.ServerTime ``` -------------------------------- ### C# Resource Entry Point Class Source: https://docs.altv.mp/cs/articles/getting-started/create-resource This C# code defines the basic structure for an AltV.Net resource. It includes the necessary `using` statements and overrides the `OnStart` and `OnStop` methods, which are called when the resource is loaded and unloaded, respectively. ```csharp using System; using AltV.Net; namespace ExampleProject { internal class ExampleResource : Resource { public override void OnStart() { Console.WriteLine("Started"); } public override void OnStop() { Console.WriteLine("Stopped"); } } } ``` -------------------------------- ### Get and Set Player Armour - C# Source: https://docs.altv.mp/js/articles/player/server-player-props Demonstrates how to get the current armour level of a player and how to set or modify it. Armour can be directly assigned or adjusted using addition and subtraction. ```cs int currentArmour = player.Armour; player.Armour = 5; player.Armour += 10; player.Armour -= 10; ``` -------------------------------- ### Configure alt:V Server Settings Source: https://docs.altv.mp/js/articles/setup Example configuration for the alt:V server's `server.toml` file, defining server name, host, port, player count, gamemode, and language. ```toml name = 'alt:V Server' host = '0.0.0.0' port = 7788 players = 128 #password = ultra-password announce = false #token = YOUR_TOKEN gamemode = 'Freeroam' website = 'example.com' language = 'en' description = 'alt:V Sample Server' modules = [ 'js-module' ] resources = [ ] ``` -------------------------------- ### Install all alt:V TypeScript types with yarn Source: https://docs.altv.mp/js/articles/create-your-first-resource Installs all available TypeScript type definitions for alt:V (client, server, shared, natives, webview) using yarn. ```bash # Combined # For usage with yarn yarn add -D @altv/types-shared @altv/types-client @altv/types-natives @altv/types-webview @altv/types-shared @altv/types-server ``` -------------------------------- ### alt:V Client Entry Point (CreateScriptRuntime) Source: https://docs.altv.mp/sdk/first-steps The `CreateScriptRuntime` function is the client-side entry point for alt:V modules. It receives the core instance, sets it for the SDK, creates a runtime instance, and returns a pointer to it. It's crucial for initializing client-side modules. ```cpp EXPORT alt::IScriptRuntime* CreateScriptRuntime(alt::ICore* core) { // Important! Sets the core for the SDK to the received instance, so you can interact with the server or client alt::ICore::SetInstance(core); // Pseudocode of creating a runtime, // how to create your own runtime will be explained in another article auto runtime = new MyRuntime(); // Return the pointer to our runtime // If it fails, return nullptr return runtime; } ```