Exports & API
legends_stress provides server-side and client-side exports for triggering stress relief effects, designed for inventory system integration.
Server Exports
useStressPill
Triggers the stress pill effect for a player. Designed for use with inventory systems like ox_inventory.
exports['legends_stress']:useStressPill(source)Parameters:
source(number): The player's server ID
ox_inventory Integration:
['stress_pill'] = {
label = 'Stress Pills',
server = {
export = 'legends_stress.useStressPill'
}
}useJoint
Triggers the joint smoking effect for a player. Designed for use with inventory systems.
exports['legends_stress']:useJoint(source)Parameters:
source(number): The player's server ID
ox_inventory Integration:
['joint'] = {
label = 'Joint',
server = {
export = 'legends_stress.useJoint'
}
}Client Exports
useStresspill
Triggers the stress pill effect on the local player.
exports['legends_stress']:useStresspill()Effects:
- Plays pill-taking animation
- Shows progress bar
- Applies visual screen effect
- Gradually reduces stress over the configured duration
useJoint
Triggers the joint smoking effect on the local player.
exports['legends_stress']:useJoint()Effects:
- Plays smoking animation
- Shows progress bar
- Applies visual screen effect
- Gradually reduces stress over the configured duration
Integration Examples
Custom Command
-- Client-side: Custom stress relief command
RegisterCommand('takepill', function()
exports['legends_stress']:useStresspill()
end)
RegisterCommand('smokejoint', function()
exports['legends_stress']:useJoint()
end)qb-inventory Useable Item
-- Server-side: Register useable items
QBCore.Functions.CreateUseableItem('stress_pill', function(source)
exports['legends_stress']:useStressPill(source)
end)
QBCore.Functions.CreateUseableItem('joint', function(source)
exports['legends_stress']:useJoint(source)
end)ESX Useable Item
-- Server-side: Register useable items for ESX
ESX.RegisterUsableItem('stress_pill', function(source)
exports['legends_stress']:useStressPill(source)
end)
ESX.RegisterUsableItem('joint', function(source)
exports['legends_stress']:useJoint(source)
end)Custom Stress Relief Item
-- Server-side: Create your own stress relief item
RegisterNetEvent('myresource:useCalmingTea', function()
local src = source
-- Check if player has item
local count = exports.ox_inventory:Search(src, 'count', 'calming_tea')
if count < 1 then return end
-- Remove item
exports.ox_inventory:RemoveItem(src, 'calming_tea', 1)
-- Trigger stress relief
exports['legends_stress']:useStressPill(src)
end)Customization
Editable Files
The following files can be customized without affecting core functionality:
- client/editable/ - Client-side customization options
- server/editable/ - Server-side customization options
- config/config.lua - All configuration settings
Stress Relief Configuration
Configure stress relief items in config/config.lua:
Config.DecreaseStress = {
stress_pill = {
value = 20, -- Total stress reduction
progressbarduration = 5, -- Progress bar time (seconds)
effectDuration = 35 -- Effect duration (seconds)
},
joint = {
value = 25,
progressbarduration = 5,
effectDuration = 35
}
}Framework Compatibility
The resource automatically detects and works with:
| Framework | Stress Storage |
|---|---|
| QB-Core | Player metadata |
| QBX-Core | Player metadata |
| ESX | player_stress database table (auto-created) |
Need Help?
Join our Discord for support: discord.gg/lgnds (opens in a new tab)