This commit is contained in:
Nordi98 2025-08-13 14:27:28 +02:00
parent 48844d7321
commit 769454360e
72 changed files with 734 additions and 0 deletions

View file

@ -0,0 +1,44 @@
function Notificaton(msg)
lib.notify({
title = 'Drunk',
description = msg
})
end

function RequestWalking(set)
RequestAnimSet(set)
while not HasAnimSetLoaded(set) do
Wait(1)
end
end

function isDrunk()
return isDrunk
end
exports('isDrunk', isDrunk)

function GetDrunkLevel()
return lib.callback.await('cs:drunk:fetch', false, 'get')
end
exports('GetDrunkLevel', GetDrunkLevel)

function SetDrunkLevel(valueS)
local valueS = type(valueS) == 'table' and valueS.client.value or valueS
if not valueS then return 0 end
return lib.callback.await('cs:drunk:fetch', false, 'set', valueS)
end
exports('SetDrunkLevel', SetDrunkLevel)

function AddDrunkLevel(valueS)
local valueS = type(valueS) == 'table' and valueS.client.value or valueS
if not valueS then return 0 end
return lib.callback.await('cs:drunk:fetch', false, 'add', valueS)
end
exports('AddDrunkLevel', AddDrunkLevel)

function RemoveDrunkLevel(valueS)
local valueS = type(valueS) == 'table' and valueS.client.value or valueS
if not valueS then return 0 end
return lib.callback.await('cs:drunk:fetch', false, 'remove', valueS)
end
exports('RemoveDrunkLevel', RemoveDrunkLevel)

View file

@ -0,0 +1,27 @@
if Config.ServerType == "QB" then
QBCore = exports['qb-core']:GetCoreObject()
elseif Config.ServerType == "ESX" then
ESX = exports['es_extended']:getSharedObject()
end

if Config.OpenUI.useCommand then
lib.addCommand(Config.OpenUI.Command_Name, {
help = 'Open Breathalyzer ',
}, function(source)
TriggerClientEvent('cs:drunk:openUI', source)
end)
end

if Config.OpenUI.useItem then
if Config.ServerType == 'ESX' then
ESX.RegisterUsableItem(Config.OpenUI.Item_Name, function(source)
TriggerClientEvent('cs:drunk:openUI', source)
end)
elseif Config.ServerType == 'QB' then
QBCore.Functions.CreateUseableItem(Config.OpenUI.Item_Name, function(source)
TriggerClientEvent('cs:drunk:openUI', source)
end)
else
--YOU CAN ADD YOUR CUSTOM EVENTS HERE
end
end