### Server Configuration Example Source: https://docs.lationscripts.com/money-wash/install This example shows how to add the 'lation_laundering' script to your server's main resources directory and ensure it starts correctly by adding it to the `server.cfg` file. ```cfg ensure lation_laundering ``` -------------------------------- ### Configure server.cfg for Lation UI Source: https://docs.lationscripts.com/modern-ui/install This configuration snippet shows the correct placement of the 'start lation_ui' command in your server.cfg file. It must be started before all other resources, including your framework. Replace 'framework' with the actual name of your framework (e.g., es_extended, qbx_core). ```cfg start lation_ui start framework # The name of your framework (es_extended, qbx_core, etc) ``` -------------------------------- ### Example Modern UI Configuration in server.cfg Source: https://docs.lationscripts.com/modern-ui/config An example `server.cfg` file demonstrating how to configure Modern UI settings, including locale and various component position overrides. Ensure convars are set before starting the `lation_ui` resource and other dependent resources. ```cfg # Modern UI Configuration setr lation:locale "en" setr lation:position:notify "top-right" setr lation:position:menu "offcenter-right" setr lation:position:textui "left-center" # Start your resources after setting convars ensure lation_ui ensure your-resource ``` -------------------------------- ### Notification Examples Source: https://docs.lationscripts.com/modern-ui/components/notification Code examples demonstrating various ways to use the notification function. ```APIDOC ### Example ```lua exports.lation_ui:notify({ title = 'Success', message = 'Profile updated successfully', type = 'success', }) exports.lation_ui:notify({ title = 'Error', message = 'Failed to save changes', type = 'error', }) exports.lation_ui:notify({ title = 'Warning', message = 'Your session is about to expire', type = 'warning', }) exports.lation_ui:notify({ title = 'Info', message = 'New features are now available', type = 'info', }) exports.lation_ui:notify({ message = 'A notification with only a message', }) exports.lation_ui:notify({ title = 'Custom', message = 'A notification with custom styles', bgColor = '#e35c5c', icon = 'fas fa-screwdriver-wrench', iconColor = '#3a3a3a', txtColor = '#e5e5e5', }) exports.lation_ui:notify({ title = 'Custom', message = 'A notification with custom styles', bgColor = '#bd71f2', icon = 'fas fa-bars', iconColor = '#3a3a3a', txtColor = '#e5e5e5', }) ``` ``` -------------------------------- ### Basic Progress Bar Example (Lua) Source: https://docs.lationscripts.com/modern-ui/components/progress-bar Demonstrates how to create a basic progress bar with a label, description, duration, and an icon. The example also shows how to handle the return value to determine if the progress was completed or cancelled. ```lua if exports.lation_ui:progressBar({ label = 'Submitting', description = 'Please wait while we process your data...', duration = 5000, icon = 'fas fa-download', }) then print('Progress completed') else print('Cancelled/incomplete') end ``` -------------------------------- ### qs-inventory Item Data Format Source: https://docs.lationscripts.com/money-wash/install This Lua code demonstrates the item data structure for 'uncounted_money' in qs-inventory, compatible with both QBCore and ESX frameworks. It defines key attributes for the custom item. ```lua -- Item data format for qs-inventory ['uncounted_money'] = { ['name'] = 'uncounted_money', ['label'] = 'Uncounted Money', ['weight'] = 1, ['type'] = 'item', ['image'] = 'uncounted_money.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = nil }, ``` -------------------------------- ### Qb-inventory Item Data Format Source: https://docs.lationscripts.com/meth-crafting/install This code snippet illustrates the item data structure required for qb-inventory. It specifies details such as name, label, weight, type, image, and usability. ```lua -- Item data format for qb-inventory ls_meth_table = { name = 'ls_meth_table', label = 'Meth Table', weight = 1000, type = 'item', image = 'ls_meth_table.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = nil } ``` -------------------------------- ### Multi-Step Progress Bar Example (Lua) Source: https://docs.lationscripts.com/modern-ui/components/progress-bar Illustrates the usage of the multi-step feature for the progress bar. This example configures a progress bar with multiple steps, each having a description, and customizes its appearance with specific colors and icons. ```lua if exports.lation_ui:progressBar({ label = 'Initializing Hack', duration = 10000, icon = 'fas fa-crosshairs', iconColor = '#EF4444', color = '#EF4444', steps = { { description = 'Connecting to server...' }, { description = 'Bypassing security protocols...' }, { description = 'Establishing secure connection...' }, { description = 'Hack in progress...' } } }) then print('Progress completed') else print('Cancelled/incomplete') end ``` -------------------------------- ### Qs-inventory Item Data Format Source: https://docs.lationscripts.com/meth-crafting/install This code snippet demonstrates the item data format for qs-inventory. It includes fields for name, label, weight, type, image, and other item-specific configurations. ```lua -- Item data format for qs-inventory ['ls_meth_table'] = { ['name'] = 'ls_meth_table', ['label'] = 'Meth Table', ['weight'] = 1000, ['type'] = 'item', ['image'] = 'ls_meth_table.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = nil } ``` -------------------------------- ### qs-inventory Item Data Format Source: https://docs.lationscripts.com/weed-growing/install This snippet displays the item data format for qs-inventory, which is compatible with both QBCore and ESX frameworks. It includes a comprehensive set of properties for item definition. ```lua -- Item data format for qs-inventory ['ls_plain_jane_seed'] = { ['name'] = 'ls_plain_jane_seed', ['label'] = 'Plain Jane Seed', ['weight'] = 5, ['type'] = 'item', ['image'] = 'ls_plain_jane_seed.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = nil }, ``` -------------------------------- ### qb-inventory Item Data Format Source: https://docs.lationscripts.com/weed-growing/install This snippet illustrates the item data structure required for qb-inventory. It includes more properties compared to ox_inventory, such as type, image, and useable status. ```lua -- Item data format for qb-inventory ls_plain_jane_seed = { name = 'ls_plain_jane_seed', label = 'Plain Jane Seed', weight = 5, type = 'item', image = 'ls_plain_jane_seed.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = nil }, ``` -------------------------------- ### qb-inventory Item Data Format Source: https://docs.lationscripts.com/money-wash/install This snippet illustrates the format for 'uncounted_money' item data in qb-inventory. It includes properties like name, label, weight, type, image, and unique, essential for adding custom items. ```lua -- Item data format for qb-inventory uncounted_money = { name = 'uncounted_money', label = 'Uncounted Money', weight = 1, type = 'item', image = 'uncounted_money.png', unique = false, useable = false, shouldClose = true, combinable = nil, description = nil }, ``` -------------------------------- ### Set Default Locale Convar Source: https://docs.lationscripts.com/modern-ui/install This convar allows you to set the default locale for the Lation UI. It must be set before the resource is started. Supported locales include 'en' and 'es'. ```cfg setr lation:locale "en" # "es", etc ``` -------------------------------- ### Configure Qb Inventory Items Source: https://docs.lationscripts.com/scuba-diving/install This snippet demonstrates the item data format for qb-inventory. It includes essential details such as item name, label, weight, type, image path, uniqueness, useability, and closing behavior. This format is used when integrating items from the install directory into qb-core. ```lua -- Item data format for qb-inventory ls_scuba_gear_1 = { name = 'ls_scuba_gear_1', label = 'Scuba Gear', weight = 4000, type = 'item', image = 'ls_scuba_gear_1.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = nil }, ``` -------------------------------- ### qb-inventory Item Data Format Source: https://docs.lationscripts.com/metal-detecting/install Illustrates the item data format for qb-inventory, including name, label, weight, type, image path, and usage properties. This is used to integrate the 'blue_metaldetector' item and its associated image into the qb-inventory system. ```lua -- Item data format for qb-inventory blue_metaldetector = { name = 'blue_metaldetector', label = 'Beginner\'s Beacon', weight = 475, type = 'item', image = 'blue_metaldetector.png', unique = false, useable = true, shouldClose = true, combinable = nil, description = nil }, ``` -------------------------------- ### Basic Notification Examples (Lua) Source: https://docs.lationscripts.com/modern-ui/components/notification These examples showcase how to display different types of notifications (success, error, warning, info) using the 'lation_ui:notify' export. They illustrate setting the title, message, and type. ```lua exports.lation_ui:notify({ title = 'Success', message = 'Profile updated successfully', type = 'success', }) exports.lation_ui:notify({ title = 'Error', message = 'Failed to save changes', type = 'error', }) exports.lation_ui:notify({ title = 'Warning', message = 'Your session is about to expire', type = 'warning', }) exports.lation_ui:notify({ title = 'Info', message = 'New features are now available', type = 'info', }) ``` -------------------------------- ### ox_inventory Item Data Format Source: https://docs.lationscripts.com/weed-growing/install This snippet shows the expected format for defining items within the ox_inventory system. It includes basic item properties like label and weight. ```lua -- Item data format for ox_inventory ['ls_plain_jane_seed'] = { label = 'Plain Jane Seed', weight = 5, }, ``` -------------------------------- ### ox_inventory Item Data Format Source: https://docs.lationscripts.com/money-wash/install This code snippet shows the expected format for defining 'uncounted_money' item data within the ox_inventory system. It is used to configure custom items for the Money Laundering script. ```lua -- Item data format for ox_inventory ['uncounted_money'] = { label = 'Uncounted Money', }, ``` -------------------------------- ### Ox_inventory Item Data Format Source: https://docs.lationscripts.com/meth-crafting/install This code snippet shows the expected format for defining item data within the ox_inventory system. It includes properties like label, weight, and stackability. ```lua -- Item data format for ox_inventory ['ls_meth_table'] = { label = 'Meth Table', weight = 1000, stack = false }, ``` -------------------------------- ### Example: Alert Dialog with Callouts (Lua) Source: https://docs.lationscripts.com/modern-ui/components/alert-dialog Illustrates the use of callouts within an alert dialog to emphasize specific information. This example shows how to include multiple callouts of different types (warning, success, error) and a custom icon callout. ```lua local alert = exports.lation_ui:alert({ header = 'Callouts', content = 'Below is a showcase of a new optional element inside alert dialogs - callouts! Make important information stand out like never before.', icon = 'fas fa-star', callouts = { { label = 'Warning', description = 'This is the warning type callout', type = 'warning' }, { label = 'Success', description = 'This is the success type callout', type = 'success' }, { label = 'Error', description = 'THis is the error type callout', type = 'error' }, { label = 'Customizable', description = 'THis callout uses a custom icon but inherits the default type settings', icon = 'fas fa-rocket' } } }) ``` -------------------------------- ### qs-inventory Item Data Format Source: https://docs.lationscripts.com/chop-shop/install Illustrates the item data format for the qs-inventory system. This format details item properties like name, label, weight, type, image, and unique status. Adhering to this structure ensures proper item integration. ```lua -- Item data format for qs-inventory ['ls_auto_parts'] = { ['name'] = 'ls_auto_parts', ['label'] = 'Auto Parts', ['weight'] = 5, ['type'] = 'item', ['image'] = 'ls_auto_parts.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = nil }, ``` -------------------------------- ### qs-inventory Item Data Format Source: https://docs.lationscripts.com/metal-detecting/install Shows the item data structure for qs-inventory, detailing fields such as name, label, weight, type, image, and various flags like unique, useable, and shouldClose. This format is applied when adding the 'blue_metaldetector' item for use with qs-inventory. ```lua -- Item data format for qs-inventory ['blue_metaldetector'] = { ['name'] = 'blue_metaldetector', ['label'] = 'Beginner\'s Beacon', ['weight'] = 475, ['type'] = 'item', ['image'] = 'blue_metaldetector.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = nil }, ``` -------------------------------- ### qb-inventory Item Data Format Source: https://docs.lationscripts.com/chop-shop/install Specifies the item data format required for qb-inventory. This format includes properties such as name, label, weight, type, image path, and usability. It's crucial for adding new items correctly to qb-inventory. ```lua -- Item data format for qb-inventory ls_auto_parts = { name = 'ls_auto_parts', label = 'Auto Parts', weight = 5, type = 'item', image = 'ls_auto_parts.png', unique = false, useable = false, shouldClose = true, combinable = nil, description = nil }, ``` -------------------------------- ### ox_inventory Item Data Format Source: https://docs.lationscripts.com/chop-shop/install Defines the structure for adding custom items to the ox_inventory system. This includes item label, weight, and other properties. Ensure the item format matches this structure for correct integration. ```lua -- Item data format for ox_inventory ['ls_auto_parts'] = { label = 'Auto Parts', weight = 5, }, ``` -------------------------------- ### Example: Destructive Action Alert (Lua) Source: https://docs.lationscripts.com/modern-ui/components/alert-dialog An example of using the alert dialog for a confirmation of a destructive action, such as deleting an item. It configures the header, content, icon, icon color, and type for a clear user prompt. The result is checked to proceed with the action. ```lua local alert = exports.lation_ui:alert({ header = 'Delete Item', content = 'Are you sure you want to delete this item?', icon = 'fas fa-trash', iconColor = '#EF4444', type = 'destructive', }) if alert == 'confirm' then print('Item deleted!') end ``` -------------------------------- ### Menu Management Functions Source: https://docs.lationscripts.com/modern-ui/components/menu Functions to register, show, hide, and get the status of menus. ```APIDOC ## Menu Management Functions ### Functions ```lua -- Register a menu exports.lation_ui:registerMenu(menuData) -- Show a registered menu exports.lation_ui:showMenu(menuId) -- Hide the current menu exports.lation_ui:hideMenu() -- Get the currently open menu ID local menuId = exports.lation_ui:getOpenMenu() ``` ### Function Descriptions - **`exports.lation_ui:registerMenu(menuData)`**: Registers a new menu with the provided `menuData` table. `menuData` should follow the structure defined in the 'Registration Options' section. - **`exports.lation_ui:showMenu(menuId)`**: Displays the menu associated with the given `menuId`. If a menu is already open, it will be replaced. - **`exports.lation_ui:hideMenu()`**: Closes the currently displayed menu. - **`exports.lation_ui:getOpenMenu()`**: Returns the ID of the currently open menu. Returns `nil` if no menu is open. ``` -------------------------------- ### Configure Qs Inventory Items Source: https://docs.lationscripts.com/scuba-diving/install This snippet illustrates the item data structure for qs-inventory. It details properties like name, label, weight, type, image, uniqueness, and usability. This format is crucial for correctly adding scuba gear items to the qs-inventory system. ```lua -- Item data format for qs-inventory ['ls_scuba_gear_1'] = { ['name'] = 'ls_scuba_gear_1', ['label'] = 'Scuba Gear', ['weight'] = 4000, ['type'] = 'item', ['image'] = 'ls_scuba_gear_1.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = nil }, ``` -------------------------------- ### Configure Ox Inventory Items Source: https://docs.lationscripts.com/scuba-diving/install This snippet shows the data format for adding 'Scuba Gear' items to the ox_inventory system. It specifies properties like label, weight, stackability, and whether the inventory should close after use. Ensure this format is followed when adding items from the provided text files. ```lua -- Item data format for ox_inventory ['ls_scuba_gear_1'] = { label = 'Scuba Gear', weight = 4000, stack = false, close = true }, ``` -------------------------------- ### ox_inventory Item Data Format Source: https://docs.lationscripts.com/metal-detecting/install Defines the structure for adding a new item, 'blue_metaldetector', to the ox_inventory system. It specifies the item's label and weight. This format is used when copying item data from the provided text file into ox_inventory's configuration. ```lua -- Item data format for ox_inventory ['blue_metaldetector'] = { label = 'Beginner\'s Beacon', weight = 475 }, ``` -------------------------------- ### Manual Migration from ox_lib alertDialog to Modern UI alert Source: https://docs.lationscripts.com/modern-ui/migration This example demonstrates the manual migration of an `ox_lib.alertDialog` function call to its Modern UI equivalent, `exports.lation_ui:alert`. It highlights the additional parameters available in Modern UI for enhanced customization, such as icons, colors, and types. ```lua -- Before (ox_lib) lib.alertDialog({ header = 'Header', content = 'A message with some words and things' }) -- After (Modern UI) exports.lation_ui:alert({ header = 'Header', content = 'A message but with optional icons, color & types', icon = 'fas fa-trash', iconColor = '#EF4444', type = 'destructive', }) ``` -------------------------------- ### Custom Styled Notification (Lua) Source: https://docs.lationscripts.com/modern-ui/components/notification These examples demonstrate how to create notifications with custom styling, including background color, icon, icon color, and text color. This allows for visually distinct alerts. ```lua exports.lation_ui:notify({ title = 'Custom', message = 'A notification with custom styles', bgColor = '#e35c5c', icon = 'fas fa-screwdriver-wrench', iconColor = '#3a3a3a', txtColor = '#e5e5e5', }) exports.lation_ui:notify({ title = 'Custom', message = 'A notification with custom styles', bgColor = '#bd71f2', icon = 'fas fa-bars', iconColor = '#3a3a3a', txtColor = '#e5e5e5', }) ``` -------------------------------- ### Add Meth Items to Ox Inventory (Lua) Source: https://docs.lationscripts.com/meth-crafting/guides/ox_core This Lua code snippet demonstrates how to add new items to the `ox_inventory` configuration for the Ox Framework. It defines the properties for 'ls_meth_table', 'ls_gas_mask', and 'ls_supply_crate', including their labels, weights, stackability, consumption, and server-side export paths. Ensure these exports are correctly registered in your server scripts. ```lua ['ls_meth_table'] = { label = 'Meth Table', weight = 1000, stack = false, consume = 0, server = { export = 'lation_meth.ls_meth_table' } }, ['ls_gas_mask'] = { label = 'Gas Mask', weight = 150, stack = false, consume = 0, server = { export = 'lation_meth.ls_gas_mask' } }, ['ls_supply_crate'] = { label = 'Supplies', weight = 1000, consume = 0, server = { export = 'lation_meth.ls_supply_crate' } } ``` -------------------------------- ### qb-inventory Item Data Format Source: https://docs.lationscripts.com/coke-processing/install Specifies the format for item data within the qb-inventory script. This includes name, label, weight, type, image path, and usability. Images should be placed in the qb-inventory/html/images directory. ```lua -- Item data format for qb-inventory ls_coke_table = { name = 'ls_coke_table', label = 'Coke Table', weight = 1000, type = 'item', image = 'ls_coke_table.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = nil } ``` -------------------------------- ### Get Player Data Source: https://docs.lationscripts.com/weed-growing/exports Retrieves player data. Optionally, you can pass a string to get a specific piece of data. ```APIDOC ## GetPlayerData (Client) ### Description Retrieves player data on the client. Optionally, you can pass a string to get a specific piece of data. ### Method `exports.lation_weed:GetPlayerData(key)` ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Request Example ```lua local data = exports.lation_weed:GetPlayerData() print('All player data: ', json.encode(data, {indent=true})) local level = exports.lation_weed:GetPlayerData('level') print('Player\'s level: ', level) ``` ### Response #### Success Response (200) * `data` (table or string) - Returns a table with all player data if key is omitted, or the value of the specified data field if key is provided. #### Response Example ```json { "example": "{ \"level\": 10, \"exp\": 500, \"plants_grown\": 25 }" } ``` ## GetPlayerData (Server) ### Description Retrieves player data on the server. Optionally, you can pass a string to get a specific piece of data. ### Method `exports.lation_weed:GetPlayerData(source, key)` ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Parameters #### Path Parameters * `source` (number) - Required - The player’s source * `key` (string) - Optional - The specific player data field you want to retrieve (e.g., `"level"`, `"exp"`, `"plants_grown"`). If omitted, returns a table with all player data. ### Request Example ```lua local source = 1 -- Replace with player's source local data = exports.lation_weed:GetPlayerData(source) print('All player data: ', json.encode(data, {indent=true})) local level = exports.lation_weed:GetPlayerData(source, 'level') print('Player\'s level: ', level) ``` ### Response #### Success Response (200) * `data` (table or string) - Returns a table with all player data if key is omitted, or the value of the specified data field if key is provided. #### Response Example ```json { "example": "{ \"level\": 10, \"exp\": 500, \"plants_grown\": 25 }" } ``` ``` -------------------------------- ### qs-inventory Item Data Format Source: https://docs.lationscripts.com/coke-processing/install Illustrates the item data format required for qs-inventory. This format includes detailed properties like name, label, weight, type, image, uniqueness, usability, and more. Images are expected in the qs-inventory/html/images directory. ```lua -- Item data format for qs-inventory ['ls_coke_table'] = { ['name'] = 'ls_coke_table', ['label'] = 'Coke Table', ['weight'] = 1000, ['type'] = 'item', ['image'] = 'ls_coke_table.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = nil }, ``` -------------------------------- ### Configure UI Locale Source: https://docs.lationscripts.com/modern-ui/config Sets the default locale for UI component strings. This convar should be set in your `server.cfg` before the `lation_ui` resource is started. ```cfg setr lation:locale "en" ``` -------------------------------- ### Notification with Only Message (Lua) Source: https://docs.lationscripts.com/modern-ui/components/notification This example shows how to display a notification that only contains a message, without a title. It's useful for simple informational alerts. ```lua exports.lation_ui:notify({ message = 'A notification with only a message', }) ``` -------------------------------- ### Get Level Data (Lua) Source: https://docs.lationscripts.com/scuba-diving/exports Returns the experience table data from the shared configuration file. This function is available on both the client and server. ```lua local experience = exports.lation_diving:getLevelData() print('Level & experience data: ', json.encode(experience, {indent = true})) ``` ```lua local experience = exports.lation_diving:getLevelData() print('Level & experience data: ', json.encode(experience, {indent = true})) ``` -------------------------------- ### Get Level Data (Lua) Source: https://docs.lationscripts.com/chop-shop/exports Retrieves the experience table data, typically defined in a configuration file. This function is available for both client and server environments. ```lua -- Client-side example local experience = exports.lation_chopshop:getLevelData() print('Level & experience data: ', json.encode(experience, {indent = true})) ``` ```lua -- Server-side example local experience = exports.lation_chopshop:getLevelData() print('Level & experience data: ', json.encode(experience, {indent = true})) ``` -------------------------------- ### Get All Labs Data - Lua Source: https://docs.lationscripts.com/coke-processing/exports Retrieves data for all available labs. This function takes no arguments and returns a table containing data for all labs. It is available on both client and server. ```lua local data = exports.lation_coke:getAllLabs() print('All labs data: ', json.encode(data, {indent=true})) ``` ```lua local data = exports.lation_coke:getAllLabs() print('All labs data: ', json.encode(data, {indent=true})) ``` -------------------------------- ### Get Assigned Model (Lua) Source: https://docs.lationscripts.com/chop-shop/exports Returns the vehicle model assigned to a player or group. This function can be called on the client without arguments, or on the server with a player's source. ```lua -- Client-side example local model = exports.lation_chopshop:getAssignedModel() print('Player/group assigned model: ', model) ``` ```lua -- Server-side example local source = 1 -- Replace with player's source local model = exports.lation_chopshop:getAssignedModel(source) print('Player/group assigned model: ', model) ``` -------------------------------- ### ox_inventory Item Data Format Source: https://docs.lationscripts.com/coke-processing/install Defines the structure for adding new items to the ox_inventory script. This includes item label, weight, and stackability. Ensure the item name matches the image file name. ```lua -- Item data format for ox_inventory ['ls_coke_table'] = { label = 'Coke Table', weight = 1000, stack = false }, ``` -------------------------------- ### Get Online Police Count with PoliceCount (Lua) Source: https://docs.lationscripts.com/drug-selling/exports The PoliceCount function returns the current number of police officers online. This is a shared export, meaning it can be called from both the client and server. ```lua local police = exports.lation_selling:PoliceCount() print('There are currently ' ..police.. ' police online!') ``` -------------------------------- ### Client Exports - OpenSellShop Source: https://docs.lationscripts.com/metal-detecting/exports Opens the sell shop menu. ```APIDOC ## Client Exports - OpenSellShop ### Description Opens the sell shop menu. ### Method Client ### Endpoint `exports.lation_detecting:OpenSellShop()` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua exports.lation_detecting:OpenSellShop() print('You opened the sell shop!') ``` ### Response #### Success Response (200) This function does not return a value. ``` -------------------------------- ### Get Player Data Client-Side Source: https://docs.lationscripts.com/weed-growing/exports Retrieves player data on the client. Can fetch all data or a specific field by key. Returns the value of the specified field or a table of all data if no key is provided. ```lua local data = exports.lation_weed:GetPlayerData() print('All player data: ', json.encode(data, {indent=true})) local level = exports.lation_weed:GetPlayerData('level') print('Player\'s level: ', level) ``` -------------------------------- ### Override UI Notification Position Source: https://docs.lationscripts.com/modern-ui/config Forces all notifications to appear at the specified position, regardless of the `position` parameter in `exports.lation_ui:notify()` calls. This convar must be set in `server.cfg` before `lation_ui` starts. ```cfg setr lation:position:notify "top" ``` -------------------------------- ### Register and Show LationScripts UI Menus Source: https://docs.lationscripts.com/modern-ui/components/menu This code registers a main menu with several option types (simple, disabled, read-only, progress bar, image, sub-menu) and a sub-menu with additional features like metadata, onSelect, events, and keybinds. Finally, it shows the main menu to the user. Assumes the `lation_ui` export is available. ```lua -- Register main menu exports.lation_ui:registerMenu({ id = 'test_menu', title = 'Test Menu', subtitle = 'Select an option below', onExit = function() print('Menu closed') end, options = { { title = 'Simple', description = 'This is a simple menu option', icon = 'fas fa-bars', }, { title = 'Disabled', description = 'This option is disabled', icon = 'fas fa-ban', iconColor = '#EF4444', disabled = true }, { title = 'Read-Only', description = 'This option is read-only', icon = 'fas fa-circle-info', iconColor = '#44aae8', readOnly = true }, { title = 'Progress Bar', description = 'This option shows a progress bar', icon = 'fas fa-bars-progress', progress = 45, }, { title = 'Image', description = 'This option shows an image', icon = 'fas fa-image', image = 'https://img.lationscripts.com/lation-scripts-primary.png', }, { title = 'Sub Menu', description = 'This option opens a sub menu', icon = 'fas fa-list', menu = 'sub_menu' } } }) -- Register submenu exports.lation_ui:registerMenu({ id = 'sub_menu', title = 'Sub Menu', subtitle = 'Select an option below', menu = 'test_menu', -- Back button to test_menu options = { { title = 'Metadata', description = 'This option has metadata', icon = 'fas fa-database', metadata = { { label = 'Label 1', value = 'Value' }, { label = 'Label 2', value = 69 } } }, { title = 'onSelect', description = 'This option triggers a function', icon = 'fas fa-play', onSelect = function() print('onSelect function triggered') end }, { title = 'Events', description = 'This option triggers a client event', icon = 'fas fa-broadcast-tower', event = 'resourceName:eventName', args = { message = 'Hello from sub_menu', } }, { title = 'Keybind', description = 'This can be triggered with a keybind', icon = 'fas fa-keyboard', keybind = 'F2', } } }) -- Show menu exports.lation_ui:showMenu('test_menu') ``` -------------------------------- ### Open Shop (Client) Source: https://docs.lationscripts.com/weed-growing/exports Opens the "Smoke on the Water" supply shop on the client. ```APIDOC ## OpenShop (Client) ### Description Opens "Smoke on the Water" supply shop on the client. ### Method `exports.lation_weed:OpenShop()` ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Request Example ```lua exports.lation_weed:OpenShop() print('You opened the supply shop!') ``` ### Response #### Success Response (200) * None #### Response Example ```json { "example": "No response body" } ``` ``` -------------------------------- ### Show Text UI - LationScripts Source: https://docs.lationscripts.com/modern-ui/components/text-ui Displays a contextual text UI with various customization options. It supports markdown formatting for descriptions and can include titles, icons, keybinds, and multi-option selections. The function takes a table of options as input. ```lua exports.lation_ui:showText({ description = 'This is a *simple* message with **formatting**' }) ``` ```lua exports.lation_ui:showText({ title = 'Interaction Available', description = 'Press to interact with this object', keybind = 'E', icon = 'fas fa-hand-paper', iconColor = '#3B82F6' }) ``` ```lua exports.lation_ui:showText({ title = 'Controls', description = 'Place the object where desired', options = { { label = 'Move Forward', icon = 'fas fa-arrow-up', keybind = 'W' }, { label = 'Move Backward', icon = 'fas fa-arrow-down', keybind = 'S' }, { label = 'Move Left', icon = 'fas fa-arrow-left', keybind = 'A' }, { label = 'Move Right', icon = 'fas fa-arrow-right', keybind = 'D' }, { label = 'Cancel', icon = 'fas fa-xmark', iconColor = '#EF4444', keybind = 'X' }, { label = 'Confirm', icon = 'fas fa-check', iconColor = '#10B981', keybind = 'SPACE' } } }) ``` -------------------------------- ### Client: WarehouseShop Source: https://docs.lationscripts.com/meth-crafting/exports Opens the user interface for the warehouse shop, displaying available properties. ```APIDOC ## Client: WarehouseShop ### Description Opens the user interface for the warehouse shop, displaying available properties. ### Method Client-side export ### Endpoint `exports.lation_meth:WarehouseShop()` ### Parameters None ### Request Example ```lua exports.lation_meth:WarehouseShop() print('You opened the warehouse shop!') ``` ### Response This function does not return a value but triggers a UI event. ``` -------------------------------- ### Get Player Data (Lua) Source: https://docs.lationscripts.com/chop-shop/exports Retrieves player data, either a specific field or the entire data table. It can be called on both the client and server, with the server version requiring a source parameter. ```lua -- Client-side example local data = exports.lation_chopshop:getPlayerData() print('All player data: ', json.encode(data, {indent=true})) local level = exports.lation_chopshop:getPlayerData('level') print('Player\'s level: ', level) ``` ```lua -- Server-side example local source = 1 -- Replace with player's source local data = exports.lation_chopshop:getPlayerData(source) print('All player data: ', json.encode(data, {indent=true})) local level = exports.lation_chopshop:getPlayerData(source, 'level') print('Player\'s level: ', level) ``` -------------------------------- ### Client Exports - OpenDetectorShop Source: https://docs.lationscripts.com/metal-detecting/exports Opens the metal detector shop menu. ```APIDOC ## Client Exports - OpenDetectorShop ### Description Opens the metal detector shop menu. ### Method Client ### Endpoint `exports.lation_detecting:OpenDetectorShop()` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua exports.lation_detecting:OpenDetectorShop() print('You opened the metal detector shop!') ``` ### Response #### Success Response (200) This function does not return a value. ``` -------------------------------- ### Get Lab Data - Lua Source: https://docs.lationscripts.com/coke-processing/exports Retrieves data for a specific lab. Requires the lab ID as a number. Returns a table containing all data associated with the provided lab ID. This function is available on both client and server. ```lua local data = exports.lation_coke:getLabData(labId) print('All table data: ', json.encode(data, {indent=true})) ``` ```lua local data = exports.lation_coke:getLabData(labId) print('All table data: ', json.encode(data, {indent=true})) ``` -------------------------------- ### Get Table Data - Lua Source: https://docs.lationscripts.com/coke-processing/exports Retrieves data for a specific table. Requires the table ID as a number. Returns a table containing all data associated with the provided table ID. This function is available on both client and server. ```lua local data = exports.lation_coke:getTableData(tableId) print('All table data: ', json.encode(data, {indent=true})) ``` ```lua local data = exports.lation_coke:getTableData(tableId) print('All table data: ', json.encode(data, {indent=true})) ``` -------------------------------- ### Open Lab Shop (Client) Source: https://docs.lationscripts.com/coke-processing/exports Opens the lab dealer menu for the player on the client-side. This function does not require any arguments. ```lua exports.lation_coke:openLabShop() print('You opened the lab dealer shop!') ``` -------------------------------- ### Get Plant Data - Lua Source: https://docs.lationscripts.com/coke-processing/exports Retrieves data for a specific plant. Requires the plant ID as a number. Returns a table containing all data associated with the provided plant ID. This function is available on both client and server. ```lua local data = exports.lation_coke:getPlantData(plantId) print('All plant data: ', json.encode(data, {indent=true})) ``` ```lua local data = exports.lation_coke:getPlantData(plantId) print('All plant data: ', json.encode(data, {indent=true})) ``` -------------------------------- ### Retrieve Player Data (Lua) Source: https://docs.lationscripts.com/meth-crafting/exports Retrieves player data. Optionally, you can pass a string key to get a specific piece of data. If no key is provided, it returns a table with all player data. This function can be called on both the client and server. ```lua local data = exports.lation_meth:GetPlayerData() print('All player data: ', json.encode(data, {indent=true})) local level = exports.lation_meth:GetPlayerData('level') print('Player\'s level: ', level) ``` ```lua local source = 1 -- Replace with player's source local data = exports.lation_meth:GetPlayerData(source) print('All player data: ', json.encode(data, {indent=true})) local level = exports.lation_meth:GetPlayerData(source, 'level') print('Player\'s level: ', level) ``` -------------------------------- ### Add Usable Items to ox_inventory (Lua) Source: https://docs.lationscripts.com/coke-processing/guides/ox_core This code snippet shows how to define new items within the `ox_inventory/data/items.lua` file. These definitions include item labels, weights, stackability, consumption, and server-side export functions. This allows these items to be used within the ox_core framework. ```lua ['ls_coke_table'] = { label = 'Coke Table', weight = 1000, stack = false, consume = 0, server = { export = 'lation_coke.ls_coke_table' } }, ['ls_coca_seed'] = { label = 'Coca Seed', weight = 5, consume = 0, server = { export = 'lation_coke.ls_coca_seed' } }, ['ls_cocaine_bag'] = { label = 'Cocaine', weight = 10, consume = 0, server = { export = 'lation_coke.ls_cocaine_bag' } }, ['ls_crack_bag'] = { label = 'Crack', weight = 10, consume = 0, server = { export = 'lation_coke.ls_crack_bag' } } ``` -------------------------------- ### Add Weed Items as Exports in ox_inventory (Lua) Source: https://docs.lationscripts.com/weed-growing/guides/ox_core This code snippet demonstrates how to add different types of weed-related items, including seeds, joints, and a weed table, to the `ox_inventory/data/items.lua` file. These additions make the items usable within the `ox_core` framework by defining their properties and server-side exports. ```lua -- Seeds ['ls_plain_jane_seed'] = { label = 'Plain Jane Seed', weight = 5, consume = 0, server = { export = 'lation_weed.ls_plain_jane_seed' } }, ['ls_banana_kush_seed'] = { label = 'Banana Kush Seed', weight = 5, consume = 0, server = { export = 'lation_weed.ls_banana_kush_seed' } }, ['ls_blue_dream_seed'] = { label = 'Blue Dream Seed', weight = 5, consume = 0, server = { export = 'lation_weed.ls_blue_dream_seed' } }, ['ls_purple_haze_seed'] = { label = 'Purple Haze Seed', weight = 5, consume = 0, server = { export = 'lation_weed.ls_purple_haze_seed' } }, ['ls_orange_crush_seed'] = { label = 'Orange Crush Seed', weight = 5, consume = 0, server = { export = 'lation_weed.ls_orange_crush_seed' } }, ['ls_cosmic_kush_seed'] = { label = 'Cosmic Kush Seed', weight = 5, consume = 0, server = { export = 'lation_weed.ls_cosmic_kush_seed' } }, -- Joints ['ls_plain_jane_joint'] = { label = 'Plain Jane Joint', weight = 5, consume = 0, server = { export = 'lation_weed.ls_plain_jane_joint' } }, ['ls_banana_kush_joint'] = { label = 'Banana Kush Joint', weight = 5, consume = 0, server = { export = 'lation_weed.ls_banana_kush_joint' } }, ['ls_blue_dream_joint'] = { label = 'Blue Dream Joint', weight = 5, consume = 0, server = { export = 'lation_weed.ls_blue_dream_joint' } }, ['ls_purple_haze_joint'] = { label = 'Purple Haze Joint', weight = 5, consume = 0, server = { export = 'lation_weed.ls_purple_haze_joint' } }, ['ls_orange_crush_joint'] = { label = 'Orange Crush Joint', weight = 5, consume = 0, server = { export = 'lation_weed.ls_orange_crush_joint' } }, ['ls_cosmic_kush_joint'] = { label = 'Cosmic Kush Joint', weight = 5, consume = 0, server = { export = 'lation_weed.ls_cosmic_kush_joint' } }, -- Table ['ls_weed_table'] = { label = 'Weed Table', weight = 1000, consume = 0, server = { exports = 'lation_weed.ls_weed_table' } } ``` -------------------------------- ### Get Player Data Server-Side Source: https://docs.lationscripts.com/weed-growing/exports Retrieves player data on the server using the player's source. Can fetch all data or a specific field by key. Returns the value of the specified field or a table of all data if no key is provided. ```lua local source = 1 -- Replace with player's source local data = exports.lation_weed:GetPlayerData(source) print('All player data: ', json.encode(data, {indent=true})) local level = exports.lation_weed:GetPlayerData(source, 'level') print('Player\'s level: ', level) ``` -------------------------------- ### Client Exports - OpenMenu Source: https://docs.lationscripts.com/metal-detecting/exports Opens the main metal detecting stats menu. ```APIDOC ## Client Exports - OpenMenu ### Description Opens the main metal detecting stats menu. ### Method Client ### Endpoint `exports.lation_detecting:OpenMenu()` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua exports.lation_detecting:OpenMenu() print('You opened the stats menu!') ``` ### Response #### Success Response (200) This function does not return a value. ``` -------------------------------- ### Override UI Text Element Position Source: https://docs.lationscripts.com/modern-ui/config Forces all text UI elements to appear at the specified position, overriding the `position` parameter in `exports.lation_ui:showText()` calls. This convar should be configured in `server.cfg` prior to starting the `lation_ui` resource. ```cfg setr lation:position:textui "left-center" ```