### Setup Prompt Group in Lua Source: https://featherframework.net/api/Prompts This Lua code demonstrates how to set up a prompt group using the FeatherCore.Prompt:SetupPromptGroup function. It shows the basic setup and an optional method to assign a specific groupId, often used when targeting entities. This setup is a prerequisite for displaying future prompts. ```lua CreateThread(function() local PromptGroup = FeatherCore.Prompt:SetupPromptGroup() --Setup Prompt Group -- Optional: Setting the Prompt Group for entities. (Used for prompts when targeting) local promptGroupId = Citizen.InvokeNative(0xB796970BD125FCE8, targetEntity) -- PromptGetGroupIdForTargetEntity local PromptGroup = FeatherCore.Prompt:SetupPromptGroup(promptGroupId) end) ``` -------------------------------- ### Feather Framework Horse Example Script Source: https://featherframework.net/api/Horses A comprehensive example script demonstrating the creation and management of horse entities using the Feather Framework API. It includes commands for spawning, customizing components, setting ownership, managing states (clean, damage), playing animations, starting scenarios, and removing the horse. This script is client-side. ```lua Feather = exports['feather-core'].initiate() local MyHorse local HorseName = "Night Star" RegisterCommand('horse', function() local x, y, z = table.unpack(GetEntityCoords(PlayerPedId())) local heading = GetEntityHeading(PlayerPedId()) MyHorse = FeatherCore.Horse:Create('a_c_horse_americanstandardbred_black', x, y, z, heading, 'male') MyHorse:SetComponentEnabled(0x150D0DAA) MyHorse:SetComponentEnabled(0x127E0412) MyHorse:SetComponentEnabled(0x75178DD2) MyHorse:SetComponentEnabled(0x293E17B3) MyHorse:SetComponentEnabled(0x9DF8175C) MyHorse:SetComponentEnabled(0x4124CC49) MyHorse:SetComponentEnabled(0x9AD2AA40) MyHorse:SetComponentEnabled(0x84E5AFA) MyHorse:SetComponentEnabled(0xC907FCA9) MyHorse:SetComponentEnabled(0x5497E784) MyHorse:SetPlayerOwnsMount(PlayerPedId()) MyHorse:DisableShockingEvents() MyHorse:ForceLockOn() MyHorse:DisableFleeFromGunshot() MyHorse:SetBlip(HorseName) MyHorse:SetPromptName(HorseName) MyHorse:SetTag(HorseName) MyHorse:SetTagVisibility(3) end) RegisterCommand('clean', function() MyHorse:Clean() MyHorse:ClearDamage() MyHorse:ClearBloodDamage() end) RegisterCommand('brush', function() MyHorse:PlayAnimation(PlayerPedId(), joaat('Interaction_Brush'), joaat('p_brushHorse02x'), 1) end) RegisterCommand('feed', function() MyHorse:PlayAnimation(PlayerPedId(), joaat('Interaction_Food'), joaat('s_horsnack_haycube01x'), true) end) RegisterCommand('wallow', function() MyHorse:StartScenario('WORLD_ANIMAL_HORSE_WALLOW') end) RegisterCommand('drink', function() MyHorse:StartScenario('WORLD_ANIMAL_HORSE_DRINK_GROUND') end) RegisterCommand('apo', function() RearUp() end) AddEventHandler('onResourceStop', function() MyHorse:Remove() end) ``` -------------------------------- ### Feather Framework: Start ProgressBar UI Source: https://featherframework.net/api/Progressbar Starts the progress bar UI with a specified message, duration, callback function, and theme. The callback function is executed once the progress is complete. Themes available are 'linear', 'circle', and 'innercircle'. ```lua progressbar.start(message, time, callback, theme) ``` ```lua progressbar.start("Loading Linear Example", 20000, function () print('DONE!!!!') end, 'linear') --or progressbar.start('Loading Circle Example...', 20000, function () print('DONE!!!!') end) ``` -------------------------------- ### Get Inventory Items Lua Example Source: https://featherframework.net/api/Inventory Retrieves items from a specified inventory using the InventoryAPI.GetInventoryItems function. This function takes an inventory ID as a parameter and returns the items within that inventory. Ensure the inventory ID is valid. ```lua InventoryAPI.GetInventoryItems('stables', 'c770bc77-3a77-11ee-b67f-18c04d04db03') ``` ```lua InventoryAPI.GetInventoryItems('stables', 'c770bc77-3a77-11ee-b67f-18c04d04db03') ``` -------------------------------- ### FeatherFramework Lua Enhanced Print Setup Source: https://featherframework.net/api/Pretty-Print Demonstrates how to use FeatherCore.Print for enhanced output, supporting string formatting and table printing. This function replaces the standard print function to provide additional features. Ensure FeatherCore is initialized before use. ```lua CreateThread(function() --Use print as you normally would. FeatherCore.Print('%{bold} %{red}TEST', { hello = "world" }) -- Print Output: TEST, { "hello" = "world"} end) ``` -------------------------------- ### Feather Framework Menu Registration and UI Elements (Lua) Source: https://featherframework.net/api/Menu This Lua script demonstrates how to initialize Feather Framework, register a multi-page menu, and populate each page with various UI elements. It includes examples of headers, subheaders, input fields, buttons, selection lists (arrows), sliders, toggles, and HTML content. Event handlers are attached to elements to capture user input and trigger actions. This script requires the 'feather-menu' export. ```lua local function TableToString(o) if type(o) == 'table' then local s = '{ ' for k, v in pairs(o) do if type(k) ~= 'number' then k = '"' .. k .. '"' end s = s .. '[' .. k .. '] = ' .. TableToString(v) .. ',' end return s .. '} ' else return tostring(o) end end FeatherMenu = exports['feather-menu'].initiate() RegisterCommand('TestMenu', function() local MyMenu = FeatherMenu:RegisterMenu('feather:character:menu', { top = '40%', left = '20%', ['720width'] = '500px', ['1080width'] = '600px', ['2kwidth'] = '700px', ['4kwidth'] = '900px', style = { -- ['height'] = '500px' -- ['border'] = '5px solid white', -- ['background-image'] = 'none', -- ['background-color'] = '#515A5A' }, contentslot = { style = { ['height'] = '300px', ['min-height'] = '300px' } }, draggable = true }) local MyFirstPage = MyMenu:RegisterPage('first:page') local MySecondPage = MyMenu:RegisterPage('second:page') local MyThirdPage = MyMenu:RegisterPage('third:page') ------ FIRST PAGE CONTENT ------ MyFirstPage:RegisterElement('header', { value = 'My First Menu', slot = "header", style = {} }) MyFirstPage:RegisterElement('subheader', { value = "First Page", slot = "header", style = {} }) MyFirstPage:RegisterElement('line', { slot = "header", }) local inputValue = '' MyFirstPage:RegisterElement('input', { label = "My First Input", placeholder = "Type something!", style = { -- ['background-image'] = 'none', -- ['background-color'] = '#E8E8E8', -- ['color'] = 'black', -- ['border-radius'] = '6px' } }, function(data) print("Input Triggered: ", data.value) inputValue = data.value end) MyFirstPage:RegisterElement('button', { label = "Update", style = { -- ['background-image'] = 'none', -- ['background-color'] = '#E8E8E8', -- ['color'] = 'black', -- ['border-radius'] = '6px' } }, function() TextDisplay:update({ value = inputValue, style = {} }) end) MyFirstPage:RegisterElement('arrows', { label = "Hair Color", start = 2, options = { { display = "Black", extra = "data" }, "Brown", "Blonde", "Red", "Silver", "White" } }, function(data) print(TableToString(data.value)) end) MyFirstPage:RegisterElement('slider', { label = "Eye Color", start = 1, min = 0, max = 100, steps = 1 }, function(data) print(TableToString(data.value)) end) MyFirstPage:RegisterElement("toggle", { label = "Glasses", start = true }, function(data) print(data.value) end) MyFirstPage:RegisterElement("html", { value = { [[
HELLO!!
]] } }) MyFirstPage:RegisterElement('bottomline') TextDisplay = MyFirstPage:RegisterElement('textdisplay', { value = "Some Text", style = {} }) MyFirstPage:RegisterElement('line', { slot = "footer", }) MyFirstPage:RegisterElement('pagearrows', { slot = "footer", total = 3, current = 1, style = {} }, function(data) if data.value == 'forward' then MySecondPage:RouteTo() else print('BACK') end end) ------ SECOND PAGE CONTENT ------ MySecondPage:RegisterElement('header', { value = 'My First Menu', slot = "header", style = {} }) MySecondPage:RegisterElement('subheader', { value = "Second Page", slot = "header", style = {} }) MySecondPage:RegisterElement('line', { slot = "header", }) MySecondPage:RegisterElement('header', { value = 'Awesome Stuff!', draggable = false, style = {} }) MySecondPage:RegisterElement('line', { slot = "footer", }) MySecondPage:RegisterElement('pagearrows', { slot = "footer", total = 3, current = 2, style = {} }, function(data) if data.value == 'forward' then MyThirdPage:RouteTo() ``` -------------------------------- ### Version File Content Example (Feather Framework) Source: https://featherframework.net/api/Version-Checks This snippet shows the content of a 'version' file used by Feather Framework for version checks. It lists different versions and their corresponding updates, formatted with angle brackets for version numbers and bullet points for updates. ```plaintext <1.3> - More awesome updates <1.1> - Some awesome updates <1.0> - My first Update ``` -------------------------------- ### FeatherFramework Lua Color and Text Formatting Examples Source: https://featherframework.net/api/Pretty-Print Illustrates the usage of ANSI escape codes within FeatherCore.Print for text formatting and colors. The `%{attribute}` format allows for text styling like bold, colors, and background colors. Refer to the documentation for a full list of supported attributes. ```lua print('%{blue}moon over the rainbow') ``` -------------------------------- ### Get User by Source (Lua) Source: https://featherframework.net/api/User Retrieves a user object based on their source identifier. This function is useful for looking up a user when you have their connection source ID. It takes a single argument, 'src', representing the source identifier. ```lua FeatherCore.Character.GetUserBySrc(src) ``` -------------------------------- ### Get Players in Instance Server Side (Lua) Source: https://featherframework.net/api/Instances Retrieves a list of all players currently within a specified instance on the server. This function only requires the instance ID as input. ```lua FeatherCore.Instance.getInstanceCharacters(id) ``` -------------------------------- ### Displaying Notifications with Feather Framework (Lua) Source: https://featherframework.net/api/Menu Provides an example of how to use the 'FeatherMenu:Notify()' function to display notifications to the user. This function accepts message content and an optional callback function that is executed when the notification is opened and closed, providing data about the notification's type and ID. ```lua FeatherMenu:Notify({ message = 'hello world' }, function(data) -- Callback on opened and closed. print(data.type .. ' : ' .. data.id) end) FeatherMenu:Notify({ message = 'hello world' }, function(data) -- Callback on opened and closed. print(data.type .. ' : ' .. data.id) end) ``` -------------------------------- ### Create Discord Re-usable Instance Source: https://featherframework.net/api/Discord-Webhooks Creates a reusable Discord webhook instance that can send multiple messages. This setup function takes the webhook URL, script name, and avatar URL. The returned instance has a `sendMessage` method. ```APIDOC ## POST /discord/setup ### Description Creates a reusable Discord webhook instance. ### Method POST ### Endpoint /discord/setup ### Parameters #### Query Parameters - **webhookurl** (string) - Required - The URL of the Discord webhook. - **webhookname** (string) - Required - The name to display for the webhook. - **webhookavatar** (string) - Optional - The avatar URL for the webhook. ### Request Example ```json { "webhookurl": "your_webhook_url", "webhookname": "My Script", "webhookavatar": "https://example.com/avatar.png" } ``` ### Response #### Success Response (200) - **instance_id** (string) - A unique identifier for the created webhook instance. #### Response Example ```json { "instance_id": "unique_instance_id" } ``` ## POST /discord/{instance_id}/sendMessage ### Description Sends a message using a pre-configured Discord webhook instance. ### Method POST ### Endpoint /discord/{instance_id}/sendMessage ### Parameters #### Path Parameters - **instance_id** (string) - Required - The ID of the Discord webhook instance. #### Request Body - **name** (string) - Required - The name of the message author. - **description** (string) - Required - The content of the message. - **embeds** (array) - Optional - An array of embed objects for rich formatting. - **color** (number) - Optional - The color of the embed. - **title** (string) - Optional - The title of the embed. - **description** (string) - Optional - The description of the embed. ### Request Example ```json { "name": "User123", "description": "This user is awesome", "embeds": [ { "color": 11342935, "title": "Embed Item 1", "description": "Items awesome description?" } ] } ``` ### Response #### Success Response (200) - **status** (string) - Indicates if the message was sent successfully. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Register Remote Procedure Source: https://featherframework.net/api/RPC This section explains how to register a remote procedure using FeatherCore.RPC.Register. It outlines the parameters for registration and provides a detailed example of a callback function. ```APIDOC ## FeatherCore.RPC.Register ### Description Registers a remote procedure that can be called by clients or the server. ### Method `FeatherCore.RPC.Register(name, callback)` ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * **name** (string) - Required - The name of the remote method to register. * **callback** (function) - Required - The function to be executed when the remote method is called. ### Request Example ```lua FeatherCore.RPC.Register("doSomething", myProcedure) ``` ### Response #### Success Response (200) This method does not return a value upon successful registration. #### Response Example N/A ### Method Callback Signature `function myProcedure(params, res, player)` #### Parameters * **params** (table) - Parameters passed to the method by the remote caller. * **res** (function) - A callback function to return values to the RPC caller asynchronously. * **player** (player) - The player who called the method (only available on the server-side). ### Method Callback Example ```lua function myProcedure(params, res, player) -- Example: Sending a response back to the caller return res("Hello " .. tostring(params.text) .. ", " .. GetPlayerName(player)) -- Example: Asynchronous response after a delay -- Citizen.SetTimeout(1000, function () -- res("Hello from server (but delayed)") -- end) -- WARNING: If you return anything from the method callback, the `ret` value will be ignored and the returned value will be passed to the caller. end ``` ``` -------------------------------- ### User API Source: https://featherframework.net/api/User This section details the API endpoints for retrieving user information. ```APIDOC ## Get User by Source ID ### Description Retrieves a user's information using their source identifier. ### Method GET ### Endpoint `/api/users/src/{src}` ### Parameters #### Path Parameters - **src** (string) - Required - The source identifier of the user. ### Request Example ```json { "example": "Not applicable for GET request with path parameter" } ``` ### Response #### Success Response (200) - **user** (object) - The user object containing user details. #### Response Example ```json { "example": "{\"id\": 1, \"name\": \"John Doe\", \"src\": \"some_source_id\"}" } ``` ``` ```APIDOC ## Get User by ID ### Description Retrieves a user's information using their unique ID. ### Method GET ### Endpoint `/api/users/{ID}` ### Parameters #### Path Parameters - **ID** (integer) - Required - The unique identifier of the user. ### Request Example ```json { "example": "Not applicable for GET request with path parameter" } ``` ### Response #### Success Response (200) - **user** (object) - The user object containing user details. #### Response Example ```json { "example": "{\"id\": 1, \"name\": \"John Doe\", \"src\": \"some_source_id\"}" } ``` ``` -------------------------------- ### Delete Prompt in Lua Source: https://featherframework.net/api/Prompts This example shows how to completely remove a registered prompt using the `firstprompt:DeletePrompt()` function. The code sets up a prompt group, registers a prompt, displays it, waits for 3 seconds, and then deletes the prompt. ```lua CreateThread(function() local PromptGroup = FeatherCore.Prompt:SetupPromptGroup() --Setup Prompt Group local firstprompt = PromptGroup:RegisterPrompt("Press Me", 0x4CC0E2FE, 1, 1, true, 'hold', {timedeventhash = "MEDIUM_TIMED_EVENT"}) --Register your first prompt while true do Wait(0) --Show your prompt group PromptGroup:ShowGroup("My first prompt group") Wait(3000) firstprompt:DeletePrompt() end end) ``` ```lua CreateThread(function() local PromptGroup = FeatherCore.Prompt:SetupPromptGroup() --Setup Prompt Group local firstprompt = PromptGroup:RegisterPrompt("Press Me", 0x4CC0E2FE, 1, 1, true, 'hold', {timedeventhash = "MEDIUM_TIMED_EVENT"}) --Register your first prompt while true do Wait(0) --Show your prompt group PromptGroup:ShowGroup("My first prompt group") Wait(3000) firstprompt:DeletePrompt() end end) ``` -------------------------------- ### Register Arrows Element in Feather Framework Source: https://featherframework.net/api/Menu Illustrates how to register an 'arrows' element for selection options. It allows setting a label, a default starting option, a list of selectable options (which can be strings or tables with display properties), layout slot, styling, sound effects, and input persistence. A callback function processes the selected value. ```lua MyFirstPage:RegisterElement('arrows', { label = "Hair Color", start = 2, options = { { display = "Black", extra = "data" }, "Brown", "Blonde", "Red", "Silver", "White" }, -- persist = false, -- sound = { -- action = "SELECT", -- soundset = "RDRO_Character_Creator_Sounds" -- }, }, function(data) -- This gets triggered whenever the arrow selected value changes print(TableToString(data.value)) end) ``` -------------------------------- ### Handle Prompt Failure Events in Lua Source: https://featherframework.net/api/Prompts This snippet demonstrates how to execute code when a prompt fails, such as due to a timeout or missed input. It registers a prompt, shows a prompt group, and checks for failure events using `firstprompt:HasFailed()`. The `hideoncomplete` parameter is mentioned but not directly used in the example. ```lua CreateThread(function() local PromptGroup = FeatherCore.Prompt:SetupPromptGroup() --Setup Prompt Group local firstprompt = PromptGroup:RegisterPrompt("Press Me", 0x4CC0E2FE, 1, 1, true, 'hold', {timedeventhash = "MEDIUM_TIMED_EVENT"}) --Register your first prompt while true do Wait(0) --Show your prompt group PromptGroup:ShowGroup("My first prompt group") -- Lets listed for the prompt click and enact some code! if firstprompt:HasCompleted() then print("First Prompt Completed!") end if firstprompt:HasFailed() then print("First Prompt Failed!") end end end) ``` ```lua CreateThread(function() local PromptGroup = FeatherCore.Prompt:SetupPromptGroup() --Setup Prompt Group local firstprompt = PromptGroup:RegisterPrompt("Press Me", 0x4CC0E2FE, 1, 1, true, 'hold', {timedeventhash = "MEDIUM_TIMED_EVENT"}) --Register your first prompt while true do Wait(0) --Show your prompt group PromptGroup:ShowGroup("My first prompt group") -- Lets listed for the prompt click and enact some code! if firstprompt:HasCompleted() then print("First Prompt Completed!") end if firstprompt:HasFailed() then print("First Prompt Failed!") end end end) ``` -------------------------------- ### Configuring and Opening Menu in Feather Framework (Lua) Source: https://featherframework.net/api/Menu Illustrates how to configure and open a menu using Feather Framework's 'MyMenu:Open()' function. It allows for optional parameters like cursorFocus and menuFocus, and specifies the 'startupPage' to control the initial view when the menu is launched. ```lua MyMenu:Open({ -- cursorFocus = false, -- menuFocus = false, startupPage = MyFirstPage }) ``` -------------------------------- ### Math API - Get Distance Between Coordinates Source: https://featherframework.net/api/Math Calculates the distance between two points in 3D space. ```APIDOC ## GET /math/distance ### Description Calculates the Euclidean distance between two sets of 3D coordinates. ### Method GET ### Endpoint `/math/distance` ### Parameters #### Query Parameters - **first** (vector3) - Required - The first set of coordinates (x, y, z). - **second** (vector3) - Required - The second set of coordinates (x, y, z). ### Request Example ```lua -- Example using FeatherCore API FeatherCore.Math.GetDistanceBetween(vector3(0, 0, 0), vector3(1, 1, 1)) ``` ### Response #### Success Response (200) - **distance** (number) - The calculated distance between the two points. #### Response Example ```json { "distance": 1.73205081 } ``` ``` -------------------------------- ### Initiate Feather Inventory API Source: https://featherframework.net/api/Inventory This snippet shows how to initialize the Feather Inventory API. It is a prerequisite for using any other inventory functions. This is a client-side call. ```lua Feather = exports['feather-inventory'].initiate() ``` ```lua Feather = exports['feather-inventory'].initiate() ``` -------------------------------- ### Initialize Feather Framework Core in Lua Source: https://featherframework.net/api/Initialize This snippet demonstrates how to initialize the Feather Framework core using Lua. It relies on the 'feather-core' export. The `initiate()` function is called to set up the core functionalities. ```lua FeatherCore = exports['feather-core'].initiate() ``` -------------------------------- ### Get User by ID (Lua) Source: https://featherframework.net/api/User Retrieves a user object based on their unique numerical ID. This function is commonly used when you know the specific ID of the user you want to access. It requires a single argument, 'ID', which is the user's unique identifier. ```lua FeatherCore.Character.GetUserByID(ID) ``` -------------------------------- ### Get Raw Blip Data - Lua Source: https://featherframework.net/api/Blips Retrieves the raw blip object, allowing the use of native functions not directly exposed by the framework. The raw blip can be accessed via the '.rawblip' property or the ':Get()' method. Dependencies include the FeatherCore library and a previously created blip. ```lua CreateThread(function() local blip = FeatherCore.Blip:SetBlip('Gift', 'blip_special_series_1', 0.2, x, y, z,vector3 or nil) local rawblip = blip.rawblip -- OR -- local rawblip = blip:Get() -- use rawblip with any other native. end) ``` -------------------------------- ### Open Menu with Feather Framework API Source: https://featherframework.net/api/Menu Opens a menu with various configuration options. Parameters include cursor focus, menu focus, startup page, and sound effects. The function takes an object with these optional parameters. ```lua MyMenu:Open({ -- cursorFocus = false, -- menuFocus = false, startupPage = MyFirstPage, -- sound = { -- action = "SELECT", -- soundset = "RDRO_Character_Creator_Sounds" -- } }) ``` ```lua MyMenu:Open({ -- cursorFocus = false, -- menuFocus = false, startupPage = MyFirstPage, -- sound = { -- action = "SELECT", -- soundset = "RDRO_Character_Creator_Sounds" -- } }) ``` -------------------------------- ### GET /inventory/items Source: https://featherframework.net/api/Inventory Retrieves items from a specified inventory. The inventory can be identified by its player source name or its UUID. ```APIDOC ## Get Items of Inventory ### Description Gets the items from a specified inventory. The inventory can be identified by its player source name or its UUID. ### Method GET ### Endpoint /inventory/items ### Parameters #### Query Parameters - **inventoryId** (string) - Required - Player Source or Inventory UUID ### Request Example ```lua InventoryAPI.GetInventoryItems('stables', 'c770bc77-3a77-11ee-b67f-18c04d04db03') ``` ### Response #### Success Response (200) - **items** (array) - A list of items in the inventory. - **itemId** (string) - The unique identifier for the item. - **quantity** (number) - The number of this item in the inventory. #### Response Example ```json { "items": [ { "itemId": "sword_01", "quantity": 1 }, { "itemId": "potion_health", "quantity": 5 } ] } ``` ``` -------------------------------- ### Create Player Instance (Lua) Source: https://featherframework.net/api/Instances Creates a player instance on the server. It requires a unique instance ID and optionally accepts a player source. If no source is provided, it defaults to the source enacting the instance. ```lua FeatherCore.Instance.create(id) -- OR FeatherCore.Instance.create(id, source) ``` -------------------------------- ### Get Raw Blip Source: https://featherframework.net/api/Blips Retrieves the raw blip object, allowing the use of external natives not included in the framework. ```APIDOC ## GET /websites/featherframework_net_api/Blips/Raw ### Description Retrieves the raw blip object for further manipulation with other natives. ### Method GET ### Endpoint /websites/featherframework_net_api/Blips/{blipId}/Raw ### Parameters #### Path Parameters - **blipId** (string) - Required - The identifier of the blip. #### Query Parameters None #### Request Body None ### Request Example ```bash GET /websites/featherframework_net_api/Blips/12345/Raw ``` ### Response #### Success Response (200) - **rawblip** (object) - The raw blip object. #### Response Example ```json { "rawblip": { /* native blip object */ } } ``` ``` -------------------------------- ### Feather Framework: Initiate ProgressBar Source: https://featherframework.net/api/Progressbar Initializes the ProgressBar globally. This is the first step to using the progress bar functionality. It returns a ProgressBar object that can be used to control the UI. ```lua progressbar = exports["feather-progressbar"]:initiate() ``` -------------------------------- ### Initialize Feather Framework Menu API in Lua Source: https://featherframework.net/api/Menu This snippet demonstrates how to initialize the Feather Framework's Menu API in Lua. It utilizes the 'feather-menu' export to access the 'initiate' function, which likely sets up the menu system for further customization. ```lua FeatherMenu = exports['feather-menu'].initiate() ``` -------------------------------- ### Get Character by Source (Lua) Source: https://featherframework.net/api/Character Retrieves character data associated with a given source identifier. This function is crucial for fetching player-specific information when the source is known. ```lua FeatherCore.Character.GetCharacter({ src = src }) ``` -------------------------------- ### Get Item from Inventory (Lua) Source: https://featherframework.net/api/Inventory Retrieves item data from the Inventory Items Table using the item's ID. This server-side function returns the details of the specified item. ```lua Feather.Items.GetItem(6) ``` -------------------------------- ### Registering Feather Menu and Commands in Lua Source: https://featherframework.net/api/Menu Initializes the Feather Menu system and registers a command to open a character menu. This involves defining menu properties, registering pages, and adding various interactive elements to each page. ```lua local function TableToString(o) if type(o) == 'table' then local s = '{ ' for k, v in pairs(o) do if type(k) ~= 'number' then k = '"' .. k .. '"' end s = s .. '[' .. k .. '] = ' .. TableToString(v) .. ',' end return s .. '} ' else return tostring(o) end end FeatherMenu = exports['feather-menu'].initiate() RegisterCommand('TestMenu', function() local MyMenu = FeatherMenu:RegisterMenu('feather:character:menu', { top = '40%', left = '20%', ['720width'] = '500px', ['1080width'] = '600px', ['2kwidth'] = '700px', ['4kwidth'] = '900px', style = { -- ['height'] = '500px' -- ['border'] = '5px solid white', -- ['background-image'] = 'none', -- ['background-color'] = '#515A5A' }, contentslot = { style = { ['height'] = '300px', ['min-height'] = '300px' } }, draggable = true }) local MyFirstPage = MyMenu:RegisterPage('first:page') local MySecondPage = MyMenu:RegisterPage('second:page') local MyThirdPage = MyMenu:RegisterPage('third:page') ------ FIRST PAGE CONTENT ------ MyFirstPage:RegisterElement('header', { value = 'My First Menu', slot = "header", style = {} }) MyFirstPage:RegisterElement('subheader', { value = "First Page", slot = "header", style = {} }) MyFirstPage:RegisterElement('line', { slot = "header", }) local inputValue = '' MyFirstPage:RegisterElement('input', { label = "My First Input", placeholder = "Type something!", style = { -- ['background-image'] = 'none', -- ['background-color'] = '#E8E8E8', -- ['color'] = 'black', -- ['border-radius'] = '6px' } }, function(data) print("Input Triggered: ", data.value) inputValue = data.value end) MyFirstPage:RegisterElement('button', { label = "Update", style = { -- ['background-image'] = 'none', -- ['background-color'] = '#E8E8E8', -- ['color'] = 'black', -- ['border-radius'] = '6px' } }, function() TextDisplay:update({ value = inputValue, style = {} }) end) MyFirstPage:RegisterElement('arrows', { label = "Hair Color", start = 2, options = { { display = "Black", extra = "data" }, "Brown", "Blonde", "Red", "Silver", "White" } }, function(data) print(TableToString(data.value)) end) MyFirstPage:RegisterElement('slider', { label = "Eye Color", start = 1, min = 0, max = 100, steps = 1 }, function(data) print(TableToString(data.value)) end) MyFirstPage:RegisterElement("toggle", { label = "Glasses", start = true }, function(data) print(data.value) end) MyFirstPage:RegisterElement("html", { value = { [[
HELLO!!
]] } }) MyFirstPage:RegisterElement('bottomline') TextDisplay = MyFirstPage:RegisterElement('textdisplay', { value = "Some Text", style = {} }) MyFirstPage:RegisterElement('line', { slot = "footer", }) MyFirstPage:RegisterElement('pagearrows', { slot = "footer", total = 3, current = 1, style = {} }, function(data) if data.value == 'forward' then ``` -------------------------------- ### Get Horse Entity Source: https://featherframework.net/api/Horses Retrieves the raw entity associated with a horse object. This method is client-side only and is useful for accessing lower-level game entity functionalities. It operates on an instantiated horse object. ```lua -- client side only local horse = FeatherCore.Horse:Create('a_c_horse_americanstandardbred_black', x, y, z, heading, 'male') horse:GetHorse() ``` -------------------------------- ### Get Key Code - Lua Source: https://featherframework.net/api/Keys Retrieves the unique code for a given key from the Feather.KeyCodes table. This is useful for identifying specific keys within the framework's input system. ```lua Feather.KeyCodes['A'] -- returns 0x7065027D ``` -------------------------------- ### Initiate Character Spawn (Lua) Source: https://featherframework.net/api/Character Initiates or spawns a character on a specified source using their character ID. This function is part of the Feather Core API and is used to bring a character into the game world. ```lua FeatherCore.Character.InitiateCharacter(src, 1) ``` -------------------------------- ### Register Button Element in Feather Framework Source: https://featherframework.net/api/Menu Shows how to register a button element on a page. Configuration options include the button's label, layout slot, CSS styling, and optional sound effects. A callback function is executed when the button is clicked. ```lua MyFirstPage:RegisterElement('button', { label = "Update", style = { -- ['background-image'] = 'none', -- ['background-color'] = '#E8E8E8', -- ['color'] = 'black', -- ['border-radius'] = '6px' }, -- sound = { -- action = "SELECT", -- soundset = "RDRO_Character_Creator_Sounds" -- }, }, function() -- This gets triggered whenever the button is clicked end) ``` -------------------------------- ### Get Player Inventory API Source: https://featherframework.net/api/Inventory Retrieves the contents and details of a player's inventory on the server side. Returns inventory ID, UUID, max weight, and ignore item limit status. ```APIDOC ## Get Player Inventory ### Description Retrieves the contents and details of a player's inventory on the server side. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```lua local _, groundInventoryID = InventoryAPI.GetInventory(src) ``` ### Response #### Success Response (Object) - **id** - The inventory ID. - **uuid** - The inventory UUID. - **max_weight** - The maximum weight capacity of the inventory. - **ignore_item_limit** (boolean) - Whether the inventory ignores item limits. #### Response Example ```lua -- Returns inventory details object ``` ``` -------------------------------- ### Open Inventory Programmatically (Client-Side) Source: https://featherframework.net/api/Inventory Opens an inventory UI for the player programmatically. Can open the player's default inventory or a specified custom inventory. This function is intended for client-side use. ```lua Feather.Inventory.Open(nil, "player") -- or Feather.Inventory.Open('5ab95e93-c590-11ee-a5cf-40b07640984b') ``` ```lua Feather.Inventory.Open(nil, "player") -- or Feather.Inventory.Open('5ab95e93-c590-11ee-a5cf-40b07640984b') ``` -------------------------------- ### Get Character Data (Lua) Source: https://featherframework.net/api/Character Retrieves detailed character data, including attributes like experience points. This function first obtains the character object by ID and then accesses its properties. ```lua local player = FeatherCore.Character.GetCharacterByID({ id = charid }) local character = player.char print(character.xp) ``` -------------------------------- ### Routing Between Pages in Feather Framework (Lua) Source: https://featherframework.net/api/Menu Shows how to define routing logic between different pages using the ':RouteTo()' method in Feather Framework. This is typically used within event handlers, such as those for page navigation arrows, to transition the user to a specified page. ```lua MySecondPage:RouteTo() MyThirdPage:RouteTo() MyFirstPage:RouteTo() MySecondPage:RouteTo() ``` -------------------------------- ### Get Character by ID (Lua) Source: https://featherframework.net/api/Character Fetches character data using a unique character ID. This is useful when you need to access a character's information without relying on the player's source. ```lua FeatherCore.Character.GetCharacterByID({ id = charid }) ``` -------------------------------- ### Open Inventory ClientSide API Source: https://featherframework.net/api/Inventory Programmatically opens an inventory for a player on the client side. Can open the player's default inventory or a custom inventory. ```APIDOC ## Open Inventory ClientSide ### Description Programmatically opens an inventory on the client side. This can be used to open the player's own inventory or a custom inventory. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```lua -- Open player inventory Feather.Inventory.Open(nil, 'player') -- Open secondary/custom inventory Feather.Inventory.Open('5ab95e93-c590-11ee-a5cf-40b07640984b') ``` ### Response #### Success Response N/A (This function performs an action and does not return a value indicating success/failure in this format.) #### Response Example ```lua -- No direct response value ``` ``` -------------------------------- ### Get Native Ped Entity with Lua Source: https://featherframework.net/api/Pedestrians Retrieves the underlying native ped entity object from a FeatherCore.Ped instance. This is useful when interacting with game natives that require the raw entity handle, providing flexibility for unsupported natives. ```lua CreateThread(function() local coords = { z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625 } local ped = FeatherCore.Ped:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false) local rawped = ped:GetPed() -- Use rawped with whatever native required the ped entity end) ``` ```lua CreateThread(function() local coords = { z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625 } local ped = FeatherCore.Ped:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false) local rawped = ped:GetPed() -- Use rawped with whatever native required the ped entity end) ``` -------------------------------- ### Open Inventory ServerSide API Source: https://featherframework.net/api/Inventory Programmatically opens an inventory for a player on the server side. Can open the player's default inventory or a custom inventory. ```APIDOC ## Open Inventory ServerSide ### Description Programmatically opens an inventory for a player on the server side. This can be used to open the player's own inventory or a custom inventory. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```lua -- Open player inventory Feather.Inventory.OpenInventory(src, nil, 'player') -- Open secondary/custom inventory Feather.Inventory.OpenInventory(src, 'c770bc77-3a77-11ee-b67f-18c04d04db03') ``` ### Response #### Success Response N/A (This function performs an action and does not return a value indicating success/failure in this format.) #### Response Example ```lua -- No direct response value ``` ``` -------------------------------- ### Get Ped Task Status (Lua) Source: https://featherframework.net/api/Pedestrians Retrieves the status of a specific ped task using its task ID. The function returns a status code, allowing for checks on task completion. It requires a task ID as input. ```lua CreateThread(function() local coords = { z = 118.38395690917968, y = 802.531982421875, x = -279.46728515625 } local ped = FeatherCore.Ped:Create('s_m_m_valdeputy_01', coords.x, coords.y, coords.z, 0, 'world', false) while (ped:GetTaskStatus(0x4924437d) ~= 8) do Wait(1000) end print("Ped task done!") end) ``` -------------------------------- ### Create Map Blip - Lua Source: https://featherframework.net/api/Blips Creates a marker (blip) on the player's map. Requires parameters for text display, blip hash, scale, and world coordinates (x, y, z) or a vector3. Dependencies include the FeatherCore library. ```lua CreateThread(function() local blip = FeatherCore.Blip:SetBlip('Gift', 'blip_special_series_1', 0.2, x, y, z, vector3 or nil) end) ``` -------------------------------- ### Update Page Element Data with Feather Framework API Source: https://featherframework.net/api/Menu Updates the data of a specific element on a page. The parameters and values must correspond to the originally registered element. Examples show updating a text display and a slider. ```lua TextDisplay:update({ value = "Hello World!", style = {} }) ``` ```lua TextDisplay:update({ value = "Hello World!", style = {} }) ``` ```lua SliderDisplay:update({ value = 1 }) ``` ```lua SliderDisplay:update({ value = 1 }) ``` -------------------------------- ### Open File Server-Side (Lua) Source: https://featherframework.net/api/Files Opens a file from a given file path. This function requires the resource name and the desired file path as arguments. It returns a file object that can be used for subsequent read or save operations. It handles both opening existing files and creating new ones if they don't exist. ```lua CreateThread(function() local file = FeatherCore.Files:Open(GetCurrentResourceName(), 'data.txt') end) ``` -------------------------------- ### Open Inventory Programmatically (Server-Side) Source: https://featherframework.net/api/Inventory Opens an inventory for a player programmatically. Can open the player's default inventory or a custom/secondary inventory using its ID. This function is for server-side use. ```lua -- Open player inventory Feather.Inventory.OpenInventory(src, nil, 'player') -- Open secondary/custom inventory Feather.Inventory.OpenInventory(src, 'c770bc77-3a77-11ee-b67f-18c04d04db03') ``` ```lua -- Open player inventory Feather.Inventory.OpenInventory(src, nil, 'player') -- Open secondary/custom inventory Feather.Inventory.OpenInventory(src, 'c770bc77-3a77-11ee-b67f-18c04d04db03') ``` -------------------------------- ### Get Item Count in Inventory (Lua) Source: https://featherframework.net/api/Inventory Retrieves the total quantity of a specific item within an inventory. This server-side function accepts the item name and either an inventory ID or a player's source ('src') to check against. ```lua Feather.Items.GetItemCount('item_train_ticket', 'c770bc77-3a77-11ee-b67f-18c04d04db03') ```