### Install MariaDB Server Source: https://docs.qbox.re/blog/linux-server-tutorial Installs the MariaDB server and client packages, then starts and enables the MariaDB service. ```bash # Install MariaDB server sudo apt install -y mariadb-server mariadb-client # Start and enable MariaDB service sudo systemctl start mariadb sudo systemctl enable mariadb # Secure MariaDB installation sudo mysql_secure_installation ``` -------------------------------- ### Enable and Start FiveM Service Source: https://docs.qbox.re/blog/linux-server-tutorial Reload systemd, enable the FiveM service to start on boot, and then start the service. ```bash sudo systemctl daemon-reload sudo systemctl enable fivem.service sudo systemctl start fivem.service ``` -------------------------------- ### Example Hook Setup in Resource Source: https://docs.qbox.re/resources/qbx_core/modules/hooks This snippet demonstrates how to set up an event hook within a resource. It imports the triggerEventHooks function and registers a NetEvent that checks conditions before proceeding. ```lua local triggerEventHooks = require '@qbx_core.modules.hooks' -- Import triggerEventHooks function from hooks module -- Example of some sort of event that could be in your resource RegisterNetEvent('your_resource:server:check_condition', function(source) -- Checks to see if any registered hooks return false if not triggerEventHooks('checkCondition', {source = source, myNumber = 10}) then return end -- Do stuff end) ``` -------------------------------- ### Install Docker Source: https://docs.qbox.re/blog/linux-server-tutorial Installs Docker on the system using a convenience script and adds the current user to the docker group. ```bash # Install Docker sudo sh <(curl -sSL https://get.docker.com) # Add your user to docker group sudo usermod -aG docker $USER # Log out and back in, then run MariaDB container docker run -d \ --name fivem-mariadb \ --restart unless-stopped \ -e MYSQL_ROOT_PASSWORD=your_root_password \ -e MYSQL_DATABASE=fivem_server \ -e MYSQL_USER=fivem_user \ -e MYSQL_PASSWORD=your_password \ -p 3306:3306 \ -v mariadb_data:/var/lib/mysql \ mariadb:latest ``` -------------------------------- ### MariaDB User List Output Example Source: https://docs.qbox.re/blog/db-remote-access Example output from the 'SELECT USER, HOST FROM mysql.user;' query, showing the newly created 'special_user' and existing root users. ```text +--------------+-----------+ | User | Host | +--------------+-----------+ | special_user | % | | root | 127.0.0.1 | | root | ::1 | | root | computer | | mariadb.sys | localhost | | root | localhost | +--------------+-----------+ ``` -------------------------------- ### CURL Request Example Source: https://docs.qbox.re/dashboard/cdn/api/upload-file-presigned-url Example of how to make a POST request to the presigned URL endpoint using cURL. ```curl curl -L -X POST 'https://api.qbox.re/v1/file/presigned-url/:token' \ -H 'Content-Type: multipart/form-data' \ -H 'Accept: application/json' ``` -------------------------------- ### CURL Request Example Source: https://docs.qbox.re/dashboard/cdn/api/create-presigned-url Example of how to make a request to the create presigned URL endpoint using cURL. Ensure to replace `` with your actual API key. ```curl curl -L 'https://api.qbox.re/v1/file/presigned-url' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Update System and Install Dependencies Source: https://docs.qbox.re/blog/linux-server-tutorial Updates package lists and installs essential command-line utilities like curl, wget, unzip, tar, and jq. ```bash # Update package lists sudo apt update && sudo apt upgrade -y # Install essential packages sudo apt install -y curl wget unzip tar jq ``` -------------------------------- ### Install playerdata module Source: https://docs.qbox.re/resources/qbx_core/modules/playerdata Add the playerdata module to your client_scripts in fxmanifest.lua to enable its functionality. ```lua client_scripts { "@qbx_core/modules/playerdata.lua" } ``` -------------------------------- ### Updated MariaDB Configuration File Source: https://docs.qbox.re/blog/db-remote-access Example of the MariaDB configuration file after adding the bind-address directive. ```ini [mysqld] datadir=C:/Program Files/MariaDB 12.0/data port=3306 innodb_buffer_pool_size=4042M bind-address = 0.0.0.0 [client] port=3306 plugin-dir=C:\ Program Files\MariaDB 12.0/lib/plugin ``` -------------------------------- ### Example: Search Players by Metadata Source: https://docs.qbox.re/resources/qbx_core/exports/server Demonstrates searching for players who have a specific nested metadata key, such as 'licences.driver'. ```lua local licensedDrivers = exports.qbx_core:SearchPlayers({ metadata = { ['licences.driver'] = true } }) ``` -------------------------------- ### MariaDB Configuration File Example Source: https://docs.qbox.re/blog/db-remote-access Default MariaDB configuration file content. This is used to locate the bind-address setting. ```ini [mysqld] datadir=C:/Program Files/MariaDB 12.0/data port=3306 innodb_buffer_pool_size=4042M [client] port=3306 plugin-dir=C:\ Program Files\MariaDB 12.0/lib/plugin ``` -------------------------------- ### Get qbx_core Version Source: https://docs.qbox.re/resources/qbx_core/exports/server Returns the current version of qbx_core set in its fxmanifest. ```lua exports.qbx_core:GetCoreVersion(InvokingResource) ``` -------------------------------- ### Original weapons.meta Audio Entry Source: https://docs.qbox.re/tebex/weapon-audio/installation Example of the original audio entry in the weapons.meta file before modification. ```xml WEAPON_M338 w_mg_m338 SLOT_WEAPON_M338 ``` -------------------------------- ### Get Bucket Objects Source: https://docs.qbox.re/resources/qbx_core/exports/server Retrieves maps of player-to-bucket and entity-to-bucket assignments. Use this to get an overview of bucket assignments. ```lua exports.qbx_core:GetBucketObjects() ``` -------------------------------- ### Detailed Log with Discord Options Source: https://docs.qbox.re/resources/qbx_core/modules/logger Demonstrates logging with detailed parameters, including source, event, message, and Discord-specific options like tags. This example shows how to configure a log entry for Discord. ```lua local logger = require '@qbx_core.modules.logger' logger.log({ source = 'my source', event = 'my event', message = 'my message', tags = { '@everyone' }, }) ``` -------------------------------- ### Get All Player Data Source: https://docs.qbox.re/resources/qbx_core/exports/server Returns all PlayerData tables for all active players. ```lua exports.qbx_core:GetPlayersData() ``` -------------------------------- ### Changing a Message in Qbox Source: https://docs.qbox.re/blog/navigating Example demonstrating how to find and update a specific message string within the Qbox project using Global Search. ```text "You are now on duty!" ``` ```text "You started your shift!" ``` -------------------------------- ### Define Hard Dependencies Source: https://docs.qbox.re/blog/how-fxmanifests-work Use the 'dependencies' block to specify required resources, server builds, policies, or game features. The resource will not start if these are not met. ```lua dependencies { '/server:4500', '/policy:subdir_file_mapping', '/onesync', '/gameBuild:h4', '/native:0xE27C97A0', 'ox_lib' } ``` -------------------------------- ### Get Registered Garages Source: https://docs.qbox.re/resources/qbx_garages/exports/server Retrieves a list of all currently registered garages. ```lua exports.qbx_garages:GetGarages() ``` -------------------------------- ### CanUse Function with Casino Membership Check Source: https://docs.qbox.re/tebex/slots/canuse This example demonstrates how to prevent players from using the slot machine unless they have the 'casino_member' metadata. Ensure the `qbx_core` resource is exported. ```lua function CanUse(source) local player = exports.qbx_core:GetPlayer(source) if not player.PlayerData.metadata.casino_member then return false end return true end ``` -------------------------------- ### GetJobs - QBX Core Source: https://docs.qbox.re/resources/qbx_core/exports/shared Retrieves the entire table of available jobs. Use this to get a list of all defined jobs. ```lua exports.qbx_core:GetJobs() ``` -------------------------------- ### Get Vehicle Make Name Source: https://docs.qbox.re/resources/qbx_core/modules/lib/client Retrieves the brand name of a given vehicle. ```lua qbx.getVehicleMakeName(vehicle) ``` -------------------------------- ### Restart MariaDB on Windows Source: https://docs.qbox.re/blog/db-remote-access Commands to stop and start the MariaDB service via the Windows Command Prompt. ```batch net stop MariaDB net start MariaDB ``` -------------------------------- ### Upload File Request Example Source: https://docs.qbox.re/dashboard/cdn/api/upload-file This snippet shows the basic structure for uploading a file using the API. Ensure you include the authorization header and the file in the multipart/form-data body. ```http POST https://api.qbox.re/v1/file Authorization: Bearer qbox_live_abc123 Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ``` -------------------------------- ### Get Permissions (Deprecated) Source: https://docs.qbox.re/resources/qbx_core/exports/server Deprecated: Retrieves all permissions for a player. Use ACE permissions instead. ```lua exports.qbx_core:GetPermission(source) ``` -------------------------------- ### Custom Log Function with JD_logsV3 Source: https://docs.qbox.re/tebex/slots/logging Example of how to replace the default logging with a custom service like JD_logsV3. This snippet shows how to send formatted messages, player IDs, and other details to a Discord channel via JD_logsV3. ```lua function Log(source, event, message, ...) local formattedMessage = logMessages[message]:format(...) exports.JD_logsV3:createLog({ EmbedMessage = formattedMessage, player_id = source, channel = "Channel name from channels.json | Discord Channel ID | Discord Webhook URL", screenshot = true, title = 'Custom Title', color = '#A1A1A1', icon = '✅' }) end ``` -------------------------------- ### Get Player Vehicles by Filters Source: https://docs.qbox.re/resources/qbx_vehicles/exports/server Queries and returns player vehicles based on provided filter criteria. If no filters are specified, all vehicles are returned. ```lua exports.qbx_vehicles:GetPlayerVehicles(filters) ``` -------------------------------- ### Troubleshoot FiveM Service Startup Source: https://docs.qbox.re/blog/linux-server-tutorial Check service status, view logs, verify script permissions, and test the server script manually. ```bash sudo systemctl status fivem.service sudo journalctl -u fivem.service --no-pager ls -la /home/fivem/server.sh sudo su - fivem cd /home/fivem ./server.sh ``` -------------------------------- ### Annotated Lua Function for IntelliSense Source: https://docs.qbox.re/blog/vscode-setup This example demonstrates how to use EmmyLua-style annotations to improve IntelliSense and type safety for Lua functions. It specifies the expected parameter type and the return type. ```lua -- Check if player is whitelisted, kept like this for backwards compatibility or future plans ---@param source Source ---@return boolean function IsWhitelisted(source) if not serverConfig.whitelist then return true end if IsPlayerAceAllowed(source --[[@as string]], serverConfig.whitelistPermission) then return true end return false end ``` -------------------------------- ### cURL Upload Request Source: https://docs.qbox.re/dashboard/cdn/api/upload-file Example of how to upload a file using cURL. Ensure the Authorization header contains a valid Bearer token. ```shell curl -L -X POST 'https://api.qbox.re/v1/file' \ -H 'Content-Type: multipart/form-data' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Get Players in Bucket Source: https://docs.qbox.re/resources/qbx_core/exports/server Retrieves a list of all players currently in a specified bucket. Returns false if no players are in any buckets. ```lua exports.qbx_core:GetPlayersInBucket(bucket) ``` -------------------------------- ### Get Player Metadata Source: https://docs.qbox.re/resources/qbx_core/exports/server Gets a specific player's metadata value. Use 'source' or 'citizenid' for identification. ```lua exports.qbx_core:GetMetadata(identifier, metadata) ``` -------------------------------- ### Registering a Third-Party Hook Source: https://docs.qbox.re/resources/qbx_core/modules/hooks This example shows how a third-party resource can register a hook to modify the behavior of another resource without altering its original code. It registers a 'checkCondition' hook. ```lua exports.qbx_core:registerHook('checkCondition', function(payload) -- payload contains everything passed into triggerEventHooks, which will depend on the resource to document if payload.myNumber == 10 then return true -- Continue as normal else return false -- Stop execution end end) ``` -------------------------------- ### Create FiveM User and Server Directory Source: https://docs.qbox.re/blog/linux-server-tutorial Creates a dedicated system user for FiveM and sets up the necessary directory structure for the server files. ```bash # Create a dedicated user for FiveM (optional but recommended) sudo adduser fivem --disabled-login --gecos "" # Switch to the fivem user sudo su - fivem # Create server directory mkdir -p /home/fivem/server cd /home/fivem/server ``` -------------------------------- ### Configure Upload Method for Qbox CDN Source: https://docs.qbox.re/dashboard/cdn/setup/lb-phone Set the upload method to 'Qbox' for video, image, and audio file types in the lb-phone config.lua file. ```lua Config.UploadMethod.Video = "Qbox" -- "Fivemanage" or "LBUpload" or "Custom" Config.UploadMethod.Image = "Qbox" -- "Fivemanage" or "LBUpload" or "Custom" Config.UploadMethod.Audio = "Qbox" -- "Fivemanage" or "LBUpload" or "Custom" ``` -------------------------------- ### GetMetadata Source: https://docs.qbox.re/resources/qbx_core/exports/server Gets a specific player's metadata value. ```APIDOC ## GetMetadata ### Description Gets a specific player's metadata value. ### Method exports.qbx_core:GetMetadata ### Parameters #### Path Parameters - **identifier** (source | citizenid) - Required - The player's source ID or citizen ID. - **metadata** (string) - Required - The metadata key to retrieve. ``` -------------------------------- ### Define Resource Metadata and Scripts Source: https://docs.qbox.re/blog/how-fxmanifests-work This snippet shows how to define author, description, version, client/server scripts, and custom arbitrary metadata using various syntaxes. ```lua author 'John Doe ' description 'Example resource' version '1.0.0' -- Scripts to run client_scripts { 'client.lua', 'client_two.lua' } server_script 'server.lua' -- Custom metadata my_data 'one' { two = 42 } my_data 'three' { four = 69 } -- Alternate syntax my_data('nine')({ ninety = "nein" }) -- Arbitrary metadata keys are allowed pizza_topping 'pineapple' ``` -------------------------------- ### Create FiveM Database and User Source: https://docs.qbox.re/blog/linux-server-tutorial Logs into MariaDB, creates a dedicated database and user for the FiveM server, and grants necessary privileges. ```bash # Login to MariaDB sudo mysql -u root -p # Create database and user (replace 'your_password' with a strong password) CREATE DATABASE fivem_server; CREATE USER 'fivem_user'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON fivem_server.* TO 'fivem_user'@'localhost'; FLUSH PRIVILEGES; EXIT; ``` -------------------------------- ### Get Zone Name Source: https://docs.qbox.re/resources/qbx_core/modules/lib/client Returns the name of the game zone at the given coordinates. ```lua qbx.getZoneName(coords) ``` -------------------------------- ### Log Custom Event with Map Coordinates Source: https://docs.qbox.re/dashboard/logging/geomap This snippet demonstrates how to log a custom event with converted longitude and latitude for map visualization. Ensure the `qbx_grafana_map` resource is installed and use the `gameToMap` export function to convert game coordinates before logging. ```lua local coords = GetEntityCoords(PlayerPedId()) local lon, lat = exports.qbx_grafana_map:gameToMap(coords.x, coords.y) lib.logger(playerSource, 'custom_event', 'custom_message', ('lon:%s'):format(lon), ('lat:%s'):format(lat)) ``` -------------------------------- ### Get Vehicle Display Name Source: https://docs.qbox.re/resources/qbx_core/modules/lib/client Retrieves the model name of a given vehicle. ```lua qbx.getVehicleDisplayName(vehicle) ``` -------------------------------- ### QBCore to Qbox Function Replacements Source: https://docs.qbox.re/converting This table lists common QBCore functions and their Qbox equivalents. Use these mappings to update your existing scripts for compatibility with Qbox. ```lua QBCore.Functions. -> exports.qbx_core: QBCore.Functions.GetPlayerData() -> QBX.PlayerData -- requires importing the playerdata module QBCore.Functions.GetPlate(vehicle) -> qbx.getVehiclePlate(vehicle) -- requires importing the lib module QBCore.Shared.Jobs -> exports.qbx_core:GetJobs() QBCore.Shared.Gangs -> exports.qbx_core:GetGangs() QBCore.Shared.Vehicles -> exports.qbx_core:GetVehiclesByName() QBCore.Shared.Weapons -> exports.qbx_core:GetWeapons() QBCore.Shared.Locations -> exports.qbx_core:GetLocations() QBCore.Shared.Items -> exports.ox_inventory:Items() ``` ```lua exports['qb-core']:KeyPressed() -> lib.hideTextUI() exports['qb-core']:HideText() -> lib.hideTextUI() exports['qb-core']:DrawText(text, position) -> lib.showTextUI(text, { position = position }) exports['qb-core']:ChangeText(text, position) -> lib.hideTextUI() lib.showTextUI(text, { position = position }) ``` -------------------------------- ### Get Player Object by Source Source: https://docs.qbox.re/resources/qbx_core/exports/server Returns the Player object for the given player ID. ```lua exports.qbx_core:GetPlayer(source) ``` -------------------------------- ### Get Street Name Source: https://docs.qbox.re/resources/qbx_core/modules/lib/client Returns the street name and cross-section name at the given coordinates. ```lua qbx.getStreetName(coords) ``` -------------------------------- ### Open Server Source: https://docs.qbox.re/resources/qbx_core/commands Lifts the server lock, allowing all players to join. This command is restricted to administrators. ```shell /openserver -- Lift the server lock and allow all players to join ``` -------------------------------- ### Import and Basic Log Source: https://docs.qbox.re/resources/qbx_core/modules/logger Imports the logger module and demonstrates a basic log call. Ensure the 'log' variable is defined before use. ```lua local logger = require '@qbx_core.modules.logger' logger.log(log) ``` -------------------------------- ### Get Player Groups Source: https://docs.qbox.re/resources/qbx_core/exports/server Retrieves a table containing all groups and their associated grades for a given player. ```lua exports.qbx_core:GetGroups(source) ``` -------------------------------- ### Ensure Tebex Slots Script Source: https://docs.qbox.re/tebex/slots/installation Add this line to your server.cfg or any other server startup configuration file to ensure the script loads on server startup. ```cfg ensure qbx_casino_slots ``` -------------------------------- ### GetOfflinePlayer Source: https://docs.qbox.re/resources/qbx_core/exports/server Gets a Player object using the given citizenid and returns it, or nil if nothing was found. ```APIDOC ## GetOfflinePlayer ### Description Gets a Player object using the given citizenid and returns it, or `nil` if nothing was found. ### Parameters #### Path Parameters - **citizenid** (string) - Required - The citizen ID of the player to retrieve. ### Returns - `Player?` - The Player object if found, otherwise `nil`. ``` -------------------------------- ### Include Additional Files Source: https://docs.qbox.re/blog/how-fxmanifests-work The 'files' section lists non-script files like JSON, images, or configuration files that the resource needs. ```lua files { 'data/main.json', 'config.ts' } ``` -------------------------------- ### Get Player Object by Phone Number Source: https://docs.qbox.re/resources/qbx_core/exports/server Returns the Player object for the given phone number. ```lua exports.qbx_core:GetPlayerByPhone(number) ``` -------------------------------- ### Verify User Creation in MariaDB Source: https://docs.qbox.re/blog/db-remote-access SQL query to list all users and their associated hosts in the mysql.user table to verify the new user was created. ```sql SELECT USER, HOST FROM mysql.user; ``` -------------------------------- ### Add Qbox API Keys Source: https://docs.qbox.re/dashboard/cdn/setup/lb-phone Add your generated Qbox API keys to the API_KEYS table in the server/apiKeys.lua file. ```lua API_KEYS = { Video = "API_KEY_HERE", Image = "API_KEY_HERE", Audio = "API_KEY_HERE", } ``` -------------------------------- ### Get Player Object by User ID Source: https://docs.qbox.re/resources/qbx_core/exports/server Returns the Player object for the given user ID. ```lua exports.qbx_core:GetPlayerByUserId(userId) ``` -------------------------------- ### Make Server Script Executable Source: https://docs.qbox.re/blog/linux-server-tutorial Grants execute permissions to the FiveM server management script. ```bash chmod +x /home/fivem/server.sh ``` -------------------------------- ### Get Player Object by Citizen ID Source: https://docs.qbox.re/resources/qbx_core/exports/server Returns the Player object for the given citizen ID. ```lua exports.qbx_core:GetPlayerByCitizenId(citizenid) ``` -------------------------------- ### Create Remote Access User and Grant Permissions Source: https://docs.qbox.re/blog/db-remote-access SQL commands to create a new user 'special_user' with a strong password and grant it SELECT, SHOW VIEW, and TRIGGER permissions on all databases. ```sql CREATE USER 'special_user'@'%' IDENTIFIED BY 'strong_password_here'; GRANT SELECT ON *.* TO 'special_user'@'%'; GRANT SHOW VIEW, TRIGGER ON *.* TO 'special_user'@'%'; FLUSH PRIVILEGES; ``` -------------------------------- ### Get Vehicle Livery Name Source: https://docs.qbox.re/resources/qbx_core/modules/lib/client Retrieves the livery name for a specific vehicle livery index. ```lua qbx.getVehicleLiveryName(vehicle, liveryIndex) ``` -------------------------------- ### Get Vehicle Mod Name Source: https://docs.qbox.re/resources/qbx_core/modules/lib/client Retrieves the mod type name for a specific vehicle modification. ```lua qbx.getVehicleModName(vehicle, modType, modIndex) ``` -------------------------------- ### Ensure Weapon Audio Script Source: https://docs.qbox.re/tebex/weapon-audio/installation Add this line to your server.cfg or any other server startup configuration file to ensure the chat_weaponaudio script is loaded. ```cfg ensure chat_weaponaudio ``` -------------------------------- ### Get Table Size Source: https://docs.qbox.re/resources/qbx_core/modules/lib/shared Returns the number of items in a table, particularly useful for non-array tables. ```lua qbx.table.size(tbl) ``` -------------------------------- ### Create Player Source: https://docs.qbox.re/resources/qbx_core/exports/server Creates a new character and saves it to the database. ```lua exports.qbx_core:CreatePlayer(playerData, offline) ``` -------------------------------- ### Configure UFW Firewall for FiveM Source: https://docs.qbox.re/blog/linux-server-tutorial Allow necessary TCP and UDP ports for FiveM traffic using UFW. ```bash sudo ufw allow 30120/tcp sudo ufw allow 30120/udp sudo ufw allow 40120/tcp sudo ufw allow 40120/udp ``` -------------------------------- ### Get On-Duty Job Count Source: https://docs.qbox.re/resources/qbx_core/exports/server Returns the count of players on-duty for a given job and a list of their IDs. ```lua exports.qbx_core:GetDutyCountJob(job) ``` -------------------------------- ### Troubleshoot Download Failures Source: https://docs.qbox.re/blog/linux-server-tutorial Test artifact URL manually using curl and jq, and check internet connectivity by pinging the artifact domain. ```bash curl -s "https://artifacts.jgscripts.com/json" | jq ping -c 4 artifacts.jgscripts.com ``` -------------------------------- ### Get All Logged-in Players Source: https://docs.qbox.re/resources/qbx_core/exports/server Returns a map of player IDs to Player objects for all currently logged-in players. ```lua exports.qbx_core:GetQBPlayers() ``` -------------------------------- ### Get Player Source by Identifier Source: https://docs.qbox.re/resources/qbx_core/exports/server Returns the player ID for a given identifier, or 0 if the player is not on the server. ```lua exports.qbx_core:GetSource(identifier) ``` -------------------------------- ### Get Vehicle ID by Plate Source: https://docs.qbox.re/resources/qbx_vehicles/exports/server Looks up and returns the vehicle ID associated with a given license plate. ```lua exports.qbx_vehicles:GetVehicleIdByPlate(plate) ``` -------------------------------- ### Register Garage Source: https://docs.qbox.re/resources/qbx_garages/exports/server Registers a garage at runtime. Use this as an alternative to defining garages in the qbx_garages configuration file. ```lua exports.qbx_garages:RegisterGarage(name, config) ``` -------------------------------- ### RegisterBossMenu Source: https://docs.qbox.re/resources/qbx_management/exports/server Creates a boss menu. This is a runtime-only change and will not persist across restarts or modify files. ```APIDOC ## RegisterBossMenu ### Description Creates a boss menu. This is a runtime-only change and will not persist across restarts or modify files. ### Method exports.qbx_management:RegisterBossMenu(menuInfo) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **menuInfo** (table) - Required - Information to create the boss menu. * **groupName** (string) - Required - The name of the group. * **type** (string) - Required - The type of menu, either 'gang' or 'job'. * **coords** (vector3) - Required - The coordinates for the menu. * **size** (vector3) - Optional - The size of the menu. Defaults to `vec3(1.5, 1.5, 1.5)`. * **rotation** (number) - Optional - The rotation of the menu. Defaults to `0.0`. ### Request Example ```lua exports.qbx_management:RegisterBossMenu({ groupName = "police", type = "job", coords = vec3(100.0, 200.0, 30.0), size = vec3(2.0, 2.0, 2.0), rotation = 45.0 }) ``` ### Response #### Success Response (200) This function does not return a value. ``` -------------------------------- ### Get Offline Player Source: https://docs.qbox.re/resources/qbx_core/exports/server Retrieves a player object using their citizen ID. Returns nil if no player is found. ```lua exports.qbx_core:GetOfflinePlayer(citizenid) ``` -------------------------------- ### Get Entities in Bucket Source: https://docs.qbox.re/resources/qbx_core/exports/server Retrieves a list of all entities currently in a specified bucket. Returns false if no entities are in any buckets. ```lua exports.qbx_core:GetEntitiesInBucket(bucket) ``` -------------------------------- ### Add Player Permission Source: https://docs.qbox.re/resources/qbx_core/commands Grants a specified permission level to a player identified by their ID. This command is restricted to administrators. ```shell /addpermission 23 god -- Grant the player with ID 23 the “god” permission ``` -------------------------------- ### Get Player User ID by Identifier Source: https://docs.qbox.re/resources/qbx_core/exports/server Returns the user ID for a given identifier, or 0 if the player is not on the server. ```lua exports.qbx_core:GetUserId(identifier) ``` -------------------------------- ### Add TCP and UDP Endpoints Source: https://docs.qbox.re/dashboard/nucleus Configure your server to listen on specific TCP and UDP endpoints. Ensure these match your FXServer configuration. ```cfg endpoint_add_tcp "0.0.0.0:30120" endpoint_add_udp "0.0.0.0:30120" ``` -------------------------------- ### Get Player Vehicle by ID Source: https://docs.qbox.re/resources/qbx_vehicles/exports/server Retrieves a specific player vehicle using its ID. Optional filters can be applied. ```lua exports.qbx_vehicles:GetPlayerVehicle(vehicleId, filters) ``` -------------------------------- ### VSCode Global Search Keybinding Source: https://docs.qbox.re/blog/navigating Use this default keybinding in VSCode to initiate a project-wide search. ```text CTRL + SHIFT + F ``` -------------------------------- ### Get Vehicle Plate Source: https://docs.qbox.re/resources/qbx_core/modules/lib/shared Retrieves the number plate of a given vehicle. Returns nil if the vehicle or its plate does not exist. ```lua qbx.getVehiclePlate(vehicle) ``` -------------------------------- ### RegisterGarage Source: https://docs.qbox.re/resources/qbx_garages/exports/server Registers a garage at runtime. This is an alternative to defining them in the qbx_garages config. ```APIDOC ## RegisterGarage ### Description Registers a garage at runtime. This is an alternative to defining them in the qbx_garages config. ### Method Server Export ### Signature `exports.qbx_garages:RegisterGarage(name, config)` ### Parameters #### Path Parameters - **name** (string) - Required - The name of the garage. - **config** (table) - Required - The configuration table for the garage. ### Response This function does not return a value. ``` -------------------------------- ### GetGangs - QBX Core Source: https://docs.qbox.re/resources/qbx_core/exports/shared Retrieves the entire table of available gangs. Use this to get a list of all defined gangs. ```lua exports.qbx_core:GetGangs() ``` -------------------------------- ### Troubleshoot Database Connection Source: https://docs.qbox.re/blog/linux-server-tutorial Test the database connection using the mysql client and check if the MariaDB service is running. ```bash mysql -u fivem_user -p sudo systemctl status mariadb ``` -------------------------------- ### Create FiveM Systemd Service File Source: https://docs.qbox.re/blog/linux-server-tutorial Defines a systemd service unit for the FiveM server, specifying its dependencies, execution parameters, and restart behavior. ```bash [Unit] Description=FiveM Server After=network.target mariadb.service [Service] Type=simple User=fivem Group=fivem WorkingDirectory=/home/fivem/server ExecStart=/home/fivem/server.sh Restart=on-failure RestartSec=5 StandardOutput=syslog StandardError=syslog SyslogIdentifier=fivem-server ``` -------------------------------- ### Get Player Money Source: https://docs.qbox.re/resources/qbx_core/exports/server Retrieves the amount of a specific money type (cash, bank, or crypto) for a given player identifier. ```lua exports.qbx_core:GetMoney(identifier, moneyType) ``` -------------------------------- ### Get On-Duty Job Type Count Source: https://docs.qbox.re/resources/qbx_core/exports/server Returns the count of players on-duty for a given job type and a list of their IDs. ```lua exports.qbx_core:GetDutyCountType(jobType) ``` -------------------------------- ### SQL Table Creation with Collation Source: https://docs.qbox.re/faq Append this to your `CREATE TABLE` statements to resolve foreign key constraint errors caused by mismatched collation types. ```sql DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ``` -------------------------------- ### Get Cardinal Direction Source: https://docs.qbox.re/resources/qbx_core/modules/lib/shared Determines and returns the cardinal direction ('North', 'South', 'East', 'West') that a given entity is facing. ```lua qbx.getCardinalDirection(entity) ``` -------------------------------- ### GetCoreVersion Source: https://docs.qbox.re/resources/qbx_core/exports/server Returns the current version of qbx_core set in its fxmanifest. ```APIDOC ## GetCoreVersion ### Description Returns the current version of `qbx_core` set in its fxmanifest. ### Method exports.qbx_core:GetCoreVersion ### Parameters #### Path Parameters - **InvokingResource** (string) - Required - The name of the resource invoking this function. ### Returns - **string** - The current version of qbx_core. ``` -------------------------------- ### Vehicle Model Names Starting with a Number Source: https://docs.qbox.re/faq When using vehicle model names that begin with a number, they must be enclosed in square brackets. ```lua ['5vigero'] = ``` -------------------------------- ### Register Boss Menu Source: https://docs.qbox.re/resources/qbx_management/exports/server Creates a boss menu on the server. This change is runtime-only and does not persist across restarts. ```lua exports.qbx_management:RegisterBossMenu(menuInfo) ``` -------------------------------- ### Define Multiple Client Scripts Source: https://docs.qbox.re/blog/how-fxmanifests-work Use 'client_scripts' with a table to load multiple client-side Lua files. A wildcard can include all Lua files in a specified folder. ```lua client_scripts { 'client.lua', 'client2.lua' } ``` ```lua client_scripts { 'clientfolder/*.lua' } ``` -------------------------------- ### Enable Qbx Core Queuing System Source: https://docs.qbox.re/resources/qbx_core/convars Enables or disables the built-in qbx_core queuing system. This convar is a boolean. ```lua set qbx:enableQueue "true" ``` -------------------------------- ### Get Vehicle Class by Hash Source: https://docs.qbox.re/resources/qbx_core/exports/server Retrieves the vehicle class for a given vehicle hash. This function queries clients and caches results. ```lua exports.qbx_core:GetVehicleClass(hash) ``` -------------------------------- ### Basic fxmanifest.lua Structure Source: https://docs.qbox.re/blog/how-fxmanifests-work A minimal fxmanifest.lua requires defining the fx_version and game. Use 'cerulean' for the newest fx_version and 'gta5' for FiveM. ```lua fx_version 'cerulean' game 'gta5' ``` -------------------------------- ### Get Group Members Source: https://docs.qbox.re/resources/qbx_core/exports/server Fetches a list of all player citizen IDs and their grades within a specified group and type (job or gang). ```lua exports.qbx_core:GetGroupMembers(group, type) ``` -------------------------------- ### getEntityAndNetIdFromBagName Source: https://docs.qbox.re/resources/qbx_core/modules/lib/client Gets and returns an entity handle and network ID from a state bag name. Returns 0 for both if an invalid entity was received. ```APIDOC ## getEntityAndNetIdFromBagName ### Description Gets and returns an entity handle and network ID from a state bag name. Will return `0` for both if an invalid entity was received. ### Method `qbx.getEntityAndNetIdFromBagName(bagName)` ### Parameters #### Path Parameters - **bagName** (string) - Required - The name of the state bag. ### Returns - **entity** (integer) - **netId** (integer) ``` -------------------------------- ### Searching for Translation Keys in Qbox Source: https://docs.qbox.re/blog/navigating Illustrates how to search for translation keys, including nested keys with dot prefixes, to locate and modify messages in Qbox's multi-language scripts. ```text info.welcome ``` -------------------------------- ### CreatePlayer Source: https://docs.qbox.re/resources/qbx_core/exports/server Creates a new character and saves it to the database. ```APIDOC ## CreatePlayer ### Description Creates a new character and saves it to the database. ### Parameters #### Path Parameters - **playerData** (PlayerData) - Required - The data for the new player. - **offline** (boolean) - Required - Whether to create the player offline. ### Returns - `Player` - The newly created Player object. ``` -------------------------------- ### OpenBossMenu Source: https://docs.qbox.re/resources/qbx_management/exports/client Opens the primary job or gang boss menu, provided the user has the necessary permissions. ```APIDOC ## OpenBossMenu ### Description Opens the primary job or gang boss menu as long as you have the proper permissions. ### Method exports.qbx_management:OpenBossMenu(groupType) ### Parameters #### Path Parameters - groupType (string) - Required - Specifies the type of menu to open. Can be either 'gang' or 'job'. ### Request Example ```lua exports.qbx_management:OpenBossMenu('job') ``` ### Response This function does not return a value. ``` -------------------------------- ### Delete File using cURL Source: https://docs.qbox.re/dashboard/cdn/api/delete-file Example of how to delete a file using cURL. Replace ':path' with the URL-encoded file path and '' with your API key. ```curl curl -L -X DELETE 'https://api.qbox.re/v1/file/:path' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer ' ``` -------------------------------- ### qbx.string.capitalize Source: https://docs.qbox.re/resources/qbx_core/modules/lib/shared Returns the given string with its first character capitalized. ```APIDOC ## qbx.string.capitalize ### Description Returns the given string with its first character capitalized. ### Signature qbx.string.capitalize(str) ### Parameters #### Parameters - **str** (string) - The string to capitalize. ### Returns - (string) The capitalized string. ``` -------------------------------- ### Get Entity and NetId from Bag Name Source: https://docs.qbox.re/resources/qbx_core/modules/lib/client Retrieves an entity handle and network ID from a state bag name. Returns 0 for both if the entity is invalid. ```lua qbx.getEntityAndNetIdFromBagName(bagName) ``` -------------------------------- ### Automated FiveM Server Artifact Download Script Source: https://docs.qbox.re/blog/linux-server-tutorial A bash script to automatically download the latest FiveM server artifacts, extract them, and prepare for execution. ```bash #!/bin/bash ARTIFACTS_URL="https://artifacts.jgscripts.com/json" DOWNLOAD_DIR="/tmp/fivem_artifact" EXTRACT_DIR="/home/fivem/server" mkdir -p "$DOWNLOAD_DIR" LATEST_ARTIFACT=$(curl -s "$ARTIFACTS_URL" | jq -r '.linuxDownloadLink') if [ -z "$LATEST_ARTIFACT" ]; then echo "Failed to find the latest artifact." exit 1 fi echo "Downloading the latest FiveM artifact..." wget -q -O "$DOWNLOAD_DIR/fx.tar.xz" "$LATEST_ARTIFACT" if [ $? -ne 0 ]; then echo "Failed to download the artifact." exit 1 fi mkdir -p "$EXTRACT_DIR" echo "Extracting fx.tar.xz..." tar -xJf "$DOWNLOAD_DIR/fx.tar.xz" -C "$EXTRACT_DIR" if [ $? -ne 0 ]; then echo "Failed to extract the artifact." exit 1 fi echo "FiveM artifact successfully downloaded and extracted to $EXTRACT_DIR" rm -rf "$DOWNLOAD_DIR" echo "Starting FiveM server..." cd "$EXTRACT_DIR" if [ -f "run.sh" ]; then chmod +x run.sh ./run.sh else echo "run.sh not found in $EXTRACT_DIR." exit 1 fi ``` -------------------------------- ### Toggle PVP Source: https://docs.qbox.re/resources/qbx_core/commands Enables or disables server-wide Player versus Player combat. This command is restricted to administrators. ```shell /togglepvp -- Enable or disable server‑wide PVP ``` -------------------------------- ### Modified weapons.meta Audio Entry Source: https://docs.qbox.re/tebex/weapon-audio/installation Example of a modified audio entry in the weapons.meta file, using a custom audio item from the Tebex Weapon Audio pack. ```xml WEAPON_M338 w_mg_m338 SLOT_WEAPON_M338 ``` -------------------------------- ### RegisterNetEvent for OnPermissionUpdate Source: https://docs.qbox.re/resources/qbx_core/events/client Register this event to handle updates to player permissions that were specifically set via Qbox. This event does not require any parameters. ```lua RegisterNetEvent('QBCore:Client:OnPermissionUpdate', function() end) ``` -------------------------------- ### Create a Job Source: https://docs.qbox.re/resources/qbx_core/exports/server Adds or overwrites a job. This change is runtime-only and does not persist across restarts. ```lua exports.qbx_core:CreateJob(jobName, job) ``` -------------------------------- ### Configure iptables Firewall for FiveM Source: https://docs.qbox.re/blog/linux-server-tutorial Allow necessary TCP and UDP ports for FiveM traffic using iptables and save the rules. ```bash sudo iptables -A INPUT -p tcp --dport 30120 -j ACCEPT sudo iptables -A INPUT -p udp --dport 30120 -j ACCEPT sudo iptables -A INPUT -p tcp --dport 40120 -j ACCEPT sudo iptables -A INPUT -p udp --dport 40120 -j ACCEPT sudo iptables-save > /etc/iptables/rules.v4 ``` -------------------------------- ### Get Registered Garages Source: https://docs.qbox.re/resources/qbx_garages/callbacks/client Call this function to retrieve a list of all garages currently registered in the system. This is useful for populating UI elements or checking available garage locations. ```lua lib.callback.await('qbx_garages:server:getGarages') ``` -------------------------------- ### Get Female Arms Without Gloves Source: https://docs.qbox.re/resources/qbx_core/modules/lib/shared Retrieves the set of female torso drawable variations that do not include gloves. Used for checking glove status and for backward compatibility. ```lua qbx.armsWithoutGloves.female ``` -------------------------------- ### FiveM Server Configuration for Zumble Source: https://docs.qbox.re/dashboard/zumble These three convars are required to connect your FiveM server to Zumble. Paste them into your server.cfg file. ```cfg setr voice_externalAddress "" setr voice_externalPort setr voice_hideEndpoints 1 ``` -------------------------------- ### Get Male Arms Without Gloves Source: https://docs.qbox.re/resources/qbx_core/modules/lib/shared Retrieves the set of male torso drawable variations that do not include gloves. Used for checking glove status and for backward compatibility. ```lua qbx.armsWithoutGloves.male ``` -------------------------------- ### RegisterNetEvent for OnMoneyChange Source: https://docs.qbox.re/resources/qbx_core/events/client Register this event to track changes in the player's cash, bank, or crypto balance. Parameters include the type of money, the amount changed, the operation performed, and the reason for the change. ```lua RegisterNetEvent('QBCore:Client:OnMoneyChange', function(moneytype, amount, operation, reason) end) ``` -------------------------------- ### Get Garage Vehicles Source: https://docs.qbox.re/resources/qbx_garages/callbacks/client Retrieves vehicles accessible by the player within a specific garage. It does not include vehicles currently spawned in the world. Use this to display a player's stored vehicles. ```lua lib.callback.await('qbx_garages:server:getGarageVehicles', false, garageName) ``` -------------------------------- ### Can Use Item Source: https://docs.qbox.re/resources/qbx_core/exports/server Checks if an item is registered as usable and returns its associated data. Returns nil if no data is found. ```lua exports.qbx_core:CanUseItem(item) ``` -------------------------------- ### Configure Loading Screen Shutdown in Qbox Source: https://docs.qbox.re/faq To ensure the loading screen shuts down correctly, either set 'setr loadscreen:externalShutdown' to false in server.cfg or ensure your multicharacter resource calls the 'ShutdownLoadingScreen()' and 'ShutdownLoadingScreenNui()' natives. ```lua setr loadscreen:externalShutdown ``` -------------------------------- ### GetLocations - QBX Core Source: https://docs.qbox.re/resources/qbx_core/exports/shared Retrieves the table of all defined locations. ```lua exports.qbx_core:GetLocations() ``` -------------------------------- ### Add Weapon to Inventory via Command Source: https://docs.qbox.re/blog/install-custom-weapons Use this command to give the configured weapon to a player through the ox_inventory system. This is a testing command to verify the weapon's addition. ```bash /giveitem 1 WEAPON_M6IC 1 ``` -------------------------------- ### GetBucketObjects Source: https://docs.qbox.re/resources/qbx_core/exports/server Returns the player to bucket and entity to bucket maps. ```APIDOC ## GetBucketObjects ### Description Returns the player to bucket and entity to bucket maps. ### Method exports.qbx_core:GetBucketObjects() ### Returns * playerBuckets: `table` * entityBuckets: `table` ``` -------------------------------- ### Me Action (Role-play) Source: https://docs.qbox.re/resources/qbx_core/commands Displays a role-play action text visible to nearby players. Requires the action message. ```bash /me checks the engine -- Role‑play action text visible to nearby players ``` -------------------------------- ### Load Audio Bank Source: https://docs.qbox.re/resources/qbx_core/modules/lib/client Attempts to load a specified audio bank. Returns true on success, false otherwise. Note: Only 10 banks can be loaded simultaneously. ```lua qbx.loadAudioBank(audioBank, timeout) ``` -------------------------------- ### Login Source: https://docs.qbox.re/resources/qbx_core/exports/server Logs into an existing character or creates a new one, and returns whether it was successful. This is the preferred function for creating characters if the owning player is online. ```APIDOC ## Login ### Description Logs into an existing character or creates a new one, and returns whether it was successful. This is the preferred function for creating characters if the owning player is online. ### Method exports.qbx_core:Login(source, citizenid, newData) ### Parameters #### Path Parameters * **source** (integer) - Required - The source ID of the player. * **citizenid** (string) - Optional - The citizen ID of the character to log into. * **newData** (PlayerEntity) - Optional - New player data if creating a character. ### Returns * `boolean` ``` -------------------------------- ### Define a Single Server Script Source: https://docs.qbox.re/blog/how-fxmanifests-work Use 'server_script' to specify a single Lua file that runs on the server side. ```lua server_script 'server.lua' ``` -------------------------------- ### Configure MariaDB to Listen on All Interfaces Source: https://docs.qbox.re/blog/db-remote-access Add this line to the [mysqld] section of your MariaDB configuration file to allow remote connections. ```ini bind-address = 0.0.0.0 ``` -------------------------------- ### GetWeapons - QBX Core Source: https://docs.qbox.re/resources/qbx_core/exports/shared Returns the weapons table. An optional weapon hash can be provided to filter results. ```lua exports.qbx_core:GetWeapons(weapon) ``` -------------------------------- ### Error Response: Plan Limit Not Configured Source: https://docs.qbox.re/dashboard/cdn/api/upload-file-presigned-url Schema for an error response when the organization's plan storage limit is not configured. ```json { "error": "Organization plan storage limit is not configured", "code": "PLAN_STORAGE_LIMIT_NOT_CONFIGURED" } ``` -------------------------------- ### Define a Single Client Script Source: https://docs.qbox.re/blog/how-fxmanifests-work Use 'client_script' to specify a single Lua file that runs on the client side. If the script is in a subfolder, include the path. ```lua client_script 'client.lua' ``` ```lua client_script 'foldername/client.lua' ``` -------------------------------- ### Create Presigned URL Source: https://docs.qbox.re/dashboard/cdn/api/create-presigned-url Generates a presigned URL for uploading files. Requires an authorization header with a Bearer API key. ```APIDOC ## GET /v1/file/presigned-url ### Description Creates a presigned URL for file uploads. ### Method GET ### Endpoint https://api.qbox.re/v1/file/presigned-url ### Parameters #### Header Parameters - **authorization** (string) - Required - API key or Bearer API key. Example: Bearer qbox_live_abc123 ### Responses #### Success Response (200) - **data** (object) - Required - **presignedUrl** (uri) - Required - **expiresIn** (integer) - Required - Possible values: >= 1 - **status** (string) - Required - Possible values: [ok] #### Response Example (200) ```json { "data": { "presignedUrl": "https://api.qbox.re/v1/file/presigned-url/eyJ2IjoxLCJleHAiOjE3NDAwMDAwMDAsIm9yZ0lkIjoiYWJjIn0.signature", "expiresIn": 300 }, "status": "ok" } ``` #### Error Response (401, 403, 429, 500) - **application/json** - **Schema: missingApiKey** - **error** (string) - Human-readable error message. Example: Missing API key - **code** (string) - Machine-readable error code. Example: MISSING_API_KEY - **Schema: invalidMetadata** - **error** (string) - Human-readable error message. Example: Missing API key - **code** (string) - Machine-readable error code. Example: MISSING_API_KEY - **Schema: rateLimit** - **error** (string) - **code** (string) - **tryAgainIn** (integer) - Possible values: >= 1 - **Schema: missingPresignedSecret** - **error** (string) - Human-readable error message. Example: Missing API key - **code** (string) - Machine-readable error code. Example: MISSING_API_KEY #### Response Example (missingApiKey) ```json { "error": "Missing API key", "code": "MISSING_API_KEY" } ``` #### Authorization - **Type**: http - **Scheme**: bearer - **Bearer Format**: API key - **Description**: Dashboard API key. Send as `Authorization: Bearer ` or pass the raw key in the Authorization header. #### Example Request (curl) ```bash curl -L 'https://api.qbox.re/v1/file/presigned-url' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer ' ``` ``` -------------------------------- ### OnPlayerUnload Source: https://docs.qbox.re/resources/qbx_core/events/server Triggered when a player begins the process of logging out. There is no guarantee that the player still exists in qbx_core's memory at the time this event is triggered. ```APIDOC ## OnPlayerUnload ### Description Triggered when a player begins the process of logging out. There is no guarantee that the player still exists in qbx_core's memory at the time this event is triggered. ### Event Name `QBCore:Server:OnPlayerUnload` ### Parameters #### Parameters - **source** (integer) - The source ID of the player. ``` -------------------------------- ### RegisterNetEvent for qbx_diving:server:sellCoral Source: https://docs.qbox.re/resources/qbx_diving/events/server Triggered when a player attempts to sell coral. Does not verify inventory. No parameters are passed. ```lua RegisterNetEvent('qbx_diving:server:sellCoral', function() end) ```