Events

Exports for getting players permille or updating it.

Lowering a players permille by identifier

TriggerServerEvent('jl_breathalyzer:server:lowerPermille', permille, identifier)

Updating a players permille by identifier

TriggerServerEvent('jl_breathalyzer:server:updatePermille', permille, identifier)

Getting a players permille by source

TriggerServerEvent('jl_breathalyzer:server:GetPermille', source)

Examples:

Here is an example of lowering a players permille by using a event from above

function ConsumedItemForDecrease()
    if consumed then
        local permille = 1 -- This will lower the permille
        local identifier = QBCore.Functions.GetIdentifier(source, 'license') -- This will get the players license from source
        TriggerServerEvent('jl_breathalyzer:server:lowerPermille', permille, identifier)
    end
end

Here is an example of updating a players permille by using a event from above

QBCore.Functions.CreateUseableItem("vodka", function(source, item)
    local Player = QBCore.Functions.GetPlayer(source)
    local permille = 0.2
    local identifier = QBCore.Functions.GetIdentifier(source, 'license')

	if Player.Functions.GetItemBySlot(item.slot) ~= nil then
        TriggerServerEvent('jl_breathalyzer:server:updatePermille', permille, identifier)
    end
end)

Event for opening the phone

QBCore.Functions.CreateUseableItem("breathalyzer", function(source)
    TriggerClientEvent("jl:client:openBreathAlyzer", source)
end)

Last updated