Client Side
βοΈ Default Trust Categories
By default, the script includes several categories for criminal activities:
Codex.PresetTrusts = {
boost = 0, -- Boosting trust level (e.g., boosting vehicles)
moonshine = 0, -- Moonshine production trust level
breaker = 0, -- Thief trust level (house robbery)
drugcooker = 0, -- Drug cooking trust level
drugfarmer = 0, -- Drug farming trust level
gunner = 0, -- Gun crafting trust level (criminal activity)
-- you can add more custom categories here if desired
}
π Adding Custom Trust Levels
One of the key features of this system is the ability to add custom trust levels for new activities you want to track. Here's an example of adding a custom level for smuggling:
Codex.PresetTrusts = {
boost = 0,
moonshine = 0,
breaker = 0,
drugcooker = 0,
drugfarmer = 0,
gunner = 0,
smuggler = 0, -- New custom trust level for smuggling
}
Now, you have a custom level called smuggler, and you can use this like any of the default categories!
π§ Using the Trust Level System (Client-side)
The Codex Trust Level system interacts with the player's trust in various categories through events and exports.
1οΈβ£ Add Trust Points to a Category
To add trust points to a category, use the following:
TriggerServerEvent("codex:addTrustLevelRequest", "boost", 5)
Explanation:
"boost"
: The category you're adding trust points to (e.g., boosting).5
: The number of trust points to add.
You can use any of the predefined or custom categories (like "moonshine"
, "smuggler"
, etc.).
2οΈβ£ Remove Trust Points from a Category
To remove trust points, use this:
TriggerServerEvent("codex:removeTrustLevelRequest", "moonshine", 3)
Explanation:
"moonshine"
: The category you're removing trust points from.3
: The number of trust points to remove.
You can replace "moonshine"
with any other category you wish.
3οΈβ£ Get Player's Trust from a Category
To get the current trust level for a category, use this export:
local boostTrust = exports['codex_trustlevel']:getTrustLevel('boost')
print("Boost Trust Level: " .. boostTrust)
Explanation:
This will return the current trust level for the boost category.
You can get the trust level for any of the predefined categories, like so:
local moonshineTrust = exports['codex_trustlevel']:getTrustLevel('moonshine')
print("Moonshine Trust Level: " .. moonshineTrust)
local smugglerTrust = exports['codex_trustlevel']:getTrustLevel('smuggler')
print("Smuggler Trust Level: " .. smugglerTrust)
π§βπ» Using Custom Trust Levels
You can easily define custom trust levels for your own criminal activities, such as smuggling, assault, or theft. This is how you would do it:
-- Add the custom trust level category to Codex.PresetTrusts
Codex.PresetTrusts = {
boost = 0,
moonshine = 0,
breaker = 0,
drugcooker = 0,
drugfarmer = 0,
gunner = 0,
smuggler = 0, -- New custom trust level for smuggling
}
-- Now you can add, remove, or query the trust level for "smuggler" just like the others
TriggerServerEvent("codex:addTrustLevelRequest", "smuggler", 10) -- Add 10 trust points to smuggling
local smugglerTrust = exports['codex_trustlevel']:getTrustLevel('smuggler')
print("Smuggler Trust Level: " .. smugglerTrust)
This way, you can track custom criminal activities with ease.
π Full Example: Adding, Removing, and Querying Trust Levels
Hereβs how you can add, remove, and query trust levels for different categories:
-- Add trust to "boost" category (e.g., boosting vehicles)
TriggerServerEvent("codex:addTrustLevelRequest", "boost", 5)
-- Remove trust from "moonshine" category (e.g., illegal moonshine production)
TriggerServerEvent("codex:removeTrustLevelRequest", "moonshine", 3)
-- Get trust levels for multiple categories
local boostTrust = exports['codex_trustlevel']:getTrustLevel('boost')
print("Boost Trust Level: " .. boostTrust)
local moonshineTrust = exports['codex_trustlevel']:getTrustLevel('moonshine')
print("Moonshine Trust Level: " .. moonshineTrust)
local smugglerTrust = exports['codex_trustlevel']:getTrustLevel('smuggler')
print("Smuggler Trust Level: " .. smugglerTrust)
π Use Case Example: Tracking Progress in Criminal Activities
Letβs say you want to create a progression system for a drug dealer. The player might start as a drugfarmer and move to a drugcooker as they progress. Hereβs an example:
-- Track trust for drug-related activities
TriggerServerEvent("codex:addTrustLevelRequest", "drugfarmer", 10) -- Add 10 points for farming
TriggerServerEvent("codex:addTrustLevelRequest", "drugcooker", 20) -- Add 20 points for cooking drugs
-- Track trust for a custom activity
TriggerServerEvent("codex:addTrustLevelRequest", "smuggler", 15) -- Add 15 points for smuggling
-- Query trust levels to see if the player is eligible for next stages
local drugfarmerTrust = exports['codex_trustlevel']:getTrustLevel('drugfarmer')
local drugcookerTrust = exports['codex_trustlevel']:getTrustLevel('drugcooker')
print("Drug Farmer Trust Level: " .. drugfarmerTrust)
print("Drug Cooker Trust Level: " .. drugcookerTrust)
This system could unlock special abilities or new items for players as they progress through these criminal activities.
π Summary
The Codex Trust Level system is a flexible, customizable way to manage criminal activities and player progression. You can track trust levels for predefined categories (like boosting, moonshine, and smuggling) and even create custom categories for new activities. This system supports adding, removing, and querying trust levels to create dynamic gameplay systems based on criminal reputation!
π‘ Key Features:
Custom Levels: Create your own categories (e.g., smuggler, assault).
Exports: Use
exports['codex_trustlevel']:getTrustLevel()
to check trust levels.Events: Use
TriggerServerEvent()
to modify trust levels.
Last updated
Was this helpful?