🔧Installations origen_notify

Remember that this resource has verified DMCA protection, and its illegal use or distribution could imply a claim for protection of Title 17 of Chapter 512 (c)(3) of the Digital Millennium Copyright Act.

We utilize the FiveM Tebex Escrow mechanism, launched in the latter part of 2021, for the verification and dissemination of our assets. Hence, any asset acquired via us can be centrally accessed and downloaded via your Keymaster profile using the following link.

Assets function exclusively on servers employing a key associated with the identical Keymaster profile. This approach guarantees the safety of the assets and restricts unauthorized usage, should the files be inadvertently shared. It's an integral component of the FiveM Tebex Escrow mechanism.

Login into Keymaster: https://keymaster.fivem.net/login


Firts Steps. Before start to installing

Prior to initiating the asset installation, verify your Server Artifacts version. It's imperative to operate on one of its recent versions for our assets to function seamlessly. This stipulation is established by FiveM in line with their Asset Escrow Framework.

Experiencing issues with FileZilla? On occasion, file transmission tools can disrupt encrypted files, causing startup issues with the asset. We advocate for the use of WinSCP, available at the given link. There have been documented challenges with FileZilla previously.

To refresh your server artifacts, locate the newest version outlined below for Windows:

Setting Up

  1. Direct yourself to the resources directory on your server; this is your asset installation point.

  2. Construct a dedicated directory for the asset, and transfer the unzipped content you downloaded earlier into this directory.

Activating the Asset

  • It's crucial to ascertain the correct startup of your asset. This could entail incorporating it into your server.cfg or possibly adjusting settings in txAdmin.

  • Post the installation of any of our assets, a server reboot is necessary to confirm appropriate synchronization with the Keymaster framework.


REQUIERED RESOURCES MINIMAL VERSIONDOWNLOAD

es_extended

Minimal 1.9.4/ Recommended: 1.10.1


📕INSTALLATION

Navigate to the resource es_extended/client/functions.lua. Once in the resource, delete the functions [ESX.ShowHelpNotification] and [ESX.ShowNotification]:

Next, copy the following lines of code that I will provide below for use.

---@Vars
local helpNotifications = {}
local OrigenNotify = exports.origen_notify

---@Funcs

---@param text string
local function Trim(text)
    return (text:gsub("^%s*(.-)%s*$", "%1"))
end

---@param text string
---@param secondKey string
local function CreateHelpNotification(text, secondKey)
    local key, textAfter = text:match('%[([^%]]+)%]%s*(para%s+.*)')
    if (not key or Trim(key) == '') then
        key, textAfter = text:match('%[([^%]]+)%]%s*(.*)')
    end
    return OrigenNotify:CreateHelp(secondKey and secondKey or (key and key or ''),
        textAfter and textAfter or (text and text or ''))
end

local function RemoveExpiredNotifications()
    local currentTime = GetGameTimer()

    for key, notification in pairs(helpNotifications) do
        if (currentTime - notification.time) > 200 then
            OrigenNotify:RemoveHelp(notification.id)
            helpNotifications[key] = nil
        end
    end
end

---@param text string
---@param key string
local function ShowHelpNotification(text, key)
    local notification = helpNotifications[text]
    if (notification) then
        notification.time = GetGameTimer()
        return
    end
    helpNotifications[text] = { time = GetGameTimer(), id = CreateHelpNotification(text, key or nil) }
end

---@Threads
CreateThread(function()
    while (true) do
        local sleepThread = 1000
        local hasNotifications = next(helpNotifications) ~= nil

        if hasNotifications then
            sleepThread = 200
            RemoveExpiredNotifications()
        end

        Wait(sleepThread)
    end
end)

function ESX.ShowHelpNotification(...)
    ShowHelpNotification(...)
end

function ESX.ShowNotification(...)
    return OrigenNotify:ShowNotification(...)
end

🤝Example of Use

---@Example Thread
CreateThread(function()
    while(true)do
        local w = 1000
        local playerPed = PlayerPedId()
        local playerCoords = GetEntityCoords(playerPed)
        local coords = vec3(255,100,100)
        local dist = #(playerCoords - coords)

        if (dist < 5) then
            --[[
                ---@param message string
                ---@param key string
                ESX.ShowHelpNotification(
                    message,
                    key
                )
            ]]
            ESX.ShowHelpNotification('Interact', 'E')
        end

        Wait(w)
    end
end)

---@Example Command
RegisterCommand('testNotify',
    function(playerId, args)
        --[[
            ---@param message string
            ESX.ShowNotification(
                messsage
            )
        ]]
        ESX.ShowNotification(
            'How are you guys!',
        )
    end, false
)

Always make a backup of your script before making any changes to ensure you can revert if needed.

Last updated