Creating Missions on ESX
f you don't have the skills to develop basic code, we recommend that you contact a trusted developer.
The quest system in qs-advancedinventory
lets you create small missions for your players, such as buying items, using objects, visiting places, or interacting with systems. You can reward XP. Here’s how it works, step-by-step. These events and exports are ONLY for server-side.
Assign Quests When the Player Joins
You must wait a few seconds before giving quests to make sure the character is fully loaded. This avoids problems where the player doesn’t receive the quests due to timing.
You want every player to receive their quests as soon as they connect to your server and their character is fully loaded. Example (inside server/main.lua
):
In this configuration we will place whether or not we want to use this system and below the name of the item that will be the money, in this case it is cash. This item must be added in your qs-advancedinventory/shared/items.lua.
How To Write the CreateQuests Function
This function checks if qs-advancedinventory
is running, then uses the createQuest
export to register one or more missions for the player.
You can customize the quests as you wish.
✅ Example:
🔍 Explanation of Each Field:
name
A unique internal ID used to update progress later
title
The title that appears in the quest UI
description
A brief explanation of what the player needs to do
reward
What the player will get once the quest reaches 100%
requiredLevel
Optional: lets you hide or lock quests until the player reaches a level
You can add as many quests as you want inside this function.
Assigning Quests to Already Connected Players
If your script restarts while players are already online, you need to reassign their quests. You can do this with a loop that runs on server start:
✅ Example:
This makes sure no one is left without quests, even if they were online during a resource restart.
How To Update Quest Progress
Now that your player has quests, you can make progress happen by calling:
You can call this any time the player does something related to a quest. You can increase progress slowly, or complete the quest instantly.
✅ A quest is considered completed once it reaches 100 progress.
✅ Example:
🧠 How Does the 10 Work?
That number means “add 10% to the progress bar” of the quest. Here are examples:
5
Adds 5% progress
10
Adds 10% progress — call it 10 times to complete
100
Instantly completes the quest
You can also make quests with multiple steps, like:
Harvest 5 plants (each adds 20)
Win 3 matches (each adds 33)
Use 10 radios (each use adds 10)
Example of a mini-script with Missions
Loads the ESX framework.
Assigns quests when the player joins (
esx:playerLoaded
).Reassigns quests to already-connected players if the resource restarts.
Adds a sample quest that completes when the player eats a
sandwich
.
Last updated