🥬Snippets origen_notify

In case you want to use the Origin_Notify as a HelpText, use this snippet
local noty_buffer = {}
QBCore.Functions.HelpNotify = function(text, textype, length)
    if noty_buffer[text] then
        noty_buffer[text].time = GetGameTimer()
    else
        local textformated = text or ""
        local key = ""
        
        if string.find(textformated, "~y~") then
            textformated = string.gsub(textformated, "~y~", "")
            key = string.sub(textformated, 1, 1)
            textformated = string.sub(textformated, 2)
            textformated = string.gsub(textformated, "~w~", "")
        end
        
        noty_buffer[text] = {
            time = GetGameTimer(),
            noty = exports["origen_notify"]:CreateHelp(key, textformated)
        }
    end
end

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(200)
        for k, v in pairs(noty_buffer) do
            if GetGameTimer() - v.time > 200 then
                exports["origen_notify"]:RemoveHelp(v.noty)
                noty_buffer[k] = nil
            end
        end
    end
end)

Paste into qb-core/client/functions.lua

Last updated