π οΈExtra Configuration
-- Custom Progressbar
function Consumables.Editable.Progressbar(name, label, duration, useWhileDead, canCancel, disableControls, animation, prop, propTwo, onFinish, onCancel, icon)
local scenario = nil
local disable = nil
if prop and prop.model then
prop = {
hash = prop.model,
bone = prop.bone or nil,
position = prop.coords or nil,
rotation = prop.rotation or nil,
}
end
if animation and animation.scene then
scenario = {
name = animation.scene,
enterAnim = true
}
animation = nil
elseif animation and animation.animDict and animation.anim then
animation = {
dict = animation.animDict,
anim = animation.anim,
duration = animation.duration,
flag = animation.flags
}
end
if type(disableControls) == "table" then
disable = {
move = disableControls.disableMovement,
car = disableControls.disableCarMovement,
combat = disableControls.disableCombat,
mouse = disableControls.disableMouse
}
end
local status = exports["is_ui"]:ProgressBar({
title = label,
icon = icon,
duration = duration,
useWhileDead = useWhileDead,
canCancel = canCancel,
prop = prop,
animation = animation,
scenario = scenario,
disable = disable
})
if status == true then
if onFinish then
onFinish()
end
elseif status == false then
if onCancel then
onCancel()
exports["is_ui"]:cancelProgressBar()
end
end
end
-- Custom Notify
function Consumables.Editable.CustomNotify(title, text, texttype, duration, icon)
exports["is_ui"]:Notify(title, text, duration, texttype, icon)
end
-- Custom Stress
function Consumables.Editable.CustomStress(type, amount)
if type == 'gain' then
TriggerEvent("aty_hud:stress:add", amount)
elseif type == 'decrease' then
TriggerEvent("aty_hud:stress:decrease", amount)
end
end
-- Custom Alcohol BAC integration
local currentBacLevel = 0.0
function Consumables.Editable.OnAlcoholUpdate(level, type)
local newBacLevel = 0.0
if level > 0 then
if type == 'heavy' then
newBacLevel = math.min(level * 0.05, 0.40)
elseif type == 'light' then
newBacLevel = math.min(level * 0.02, 0.25)
end
end
if newBacLevel ~= currentBacLevel then
currentBacLevel = newBacLevel
if newBacLevel == 0.0 then
TriggerServerEvent("snipe-evidence:server:RemoveBACLevel")
else
TriggerServerEvent("snipe-evidence:server:toggleBACLevel", true, currentBacLevel)
end
end
end
exports('GetBACLevel', function()
return currentBacLevel
end)
exports('IsDrunk', function()
return currentBacLevel > 0
end)
-- Custom Drug Testing integration
local activeDrugs = {}
function Consumables.Editable.OnDrugUpdate(bool, type)
if bool then
activeDrugs[type] = true
else
activeDrugs[type] = nil
end
end
exports('GetHighDrug', function()
local drugs = {}
for k, _ in pairs(activeDrugs) do
drugs[#drugs + 1] = k
end
return drugs
end)
exports('IsHigh', function()
return next(activeDrugs) ~= nil
end)
-- Listener events for r14-evidence system to detect alcohol and drug consumption
RegisterNetEvent('pixel-consumables:alcohol', function(itemName)
-- This event is registered to allow the breathalyzer system to detect alcohol consumption
end)
RegisterNetEvent('pixel-consumables:drugs', function(itemName)
-- This event is registered to allow the drug testing system to detect drug consumption
end)", amount)
elseif type == 'decrease' then
TriggerEvent("aty_hud:stress:decrease", amount)
end
endLast updated