Developer Documentation

All exports and events available to integrate this resource into others.

Exports List (Clientsided)

How to send an notifcation with our export

--- @param data: {
--     message = string,
--     title = string,
--     type = string,
--     duration = int
-- }
exports['dillen_notifications']:sendNotification(data)

Trigger Events (Serversided)

How to send an notification from server side with our trigger

Here is an example:

TriggerClientEvent('dillen_notify:sendNotification', playerId, {
    message = 'This is a ~r~error~s~ notification',
    title = 'Error',
    type = 'error',
    duration = 5000
})

ESX compatibility

Find ESX.ShowNotification and replace the function with the following code:

function ESX.ShowNotification(message, type, data)
    if GetResourceState("dillen_notifications") ~= "missing" then
        local _data = data or {}

        return exports['dillen_notifications']:sendNotification({
            message = message,
            type = type or 'info',
            title = _data.title or 'Notification',
            duration = _data.duration or 4000
        })
    end

    print("[^1ERROR^7] ^5Dillen Notifications^7 is Missing!")
end

QB-Core compatibility

Find QBCore-Functions.Notify and replace the function with the following code:

function QBCore.Functions.Notify(message, type, data)
    if GetResourceState("dillen_notifications") ~= "missing" then
        local _data = data or {}

        return exports['dillen_notifications']:sendNotification({
            message = message,
            type = type or 'info',
            title = _data.title or 'Notification',
            duration = _data.duration or 4000
        })
    end

    print("[^1ERROR^7] ^5Dillen Notifications^7 is Missing!")
end

Last updated