[HELP] Adding stress script

Hi there guys, I was trying to figure out how to create a code that checks if player has used joint then it reduces stress but i can’t figure it out… Can someone help me? I’m using this script: https://forum.cfx.re/t/release-updated-19-12-2019-stress-system-with-logs-by-utku-esx-status/902910/1

Hey,
It’s actually quite simple.

server.lua:

local reduce_value = 10 -- Change this value to the amount of stress you want to reduce when using the item
local item_name = 'joint' -- Change this to the item name you want to use (Check if the item exists in your database!)

ESX.RegisterUsableItem(item_name, function(playerId) -- Register the item as usable item in ESX
    local xPlayer = ESX.GetPlayerFromId(playerId) -- Get the player object
    xPlayer.removeInventoryItem(item_name, 1) -- Remove the item from the player's inventory
    TriggerEvent('stress:remove', reduce_value) -- Remove the stress from the player
    xPlayer.showNotification('You smoked a joint and feel relaxed.') -- Show a notification to the player
end)

Sources: