Notifications

You can easily add your own notification system. To do this, go to editable/notif/custom.lua and set up your system using an event. Here is the configuration of our notification system integrated into PPanelAdmin.

Notify = {}

function Notify.Send(playerId, message, title, type, duration)
    if not playerId then
        print('^1[PPanelAdmin] Notify.Send: playerId est nil !^0')
        return
    end

    TriggerClientEvent('pnotif:sendNotification', playerId, {
        title = title or 'Notification',
        message = message or '',
        type = type or 'info',
        duration = duration or 4000
    })
end

And here is the custom.lua file, where you can integrate your own system.

-----------------------------------------------
-- NOTIFICATION SYSTEM
-- SYSTÈME DE NOTIFICATION
-- Easy integration with any notification system (events/exports)
-- Intégration facile avec n'importe quel système de notification (events/exports)
-----------------------------------------------

Notify = {}

--[[
    FR :
    Ce système de notification est entièrement personnalisable.
    Les développeurs peuvent remplacer ou connecter leur propre
    système de notifications directement au script PPanelAdmin en
    modifiant cette fonction ou en utilisant leurs events/exports.

    EN :
    This notification system is fully customizable.
    Developers can replace or connect their own notification
    system directly to the PPanelAdmin script by editing this function
    or using their own events/exports.
--]]

function Notify.Send(playerId, message, title, type, duration)
    if not playerId then
        print('^1[PPanelAdmin] Notify.Send: playerId is nil!^0')
        return
    end

    -- CUSTOMIZE YOUR NOTIFICATION SYSTEM HERE / PERSONNALISEZ VOTRE SYSTÈME DE NOTIFICATION ICI
    -- Example / Exemple:
    TriggerClientEvent('admin:notify', playerId, {
        title = title or 'Admin Panel',
        message = message or '',
        type = type or 'info',
        duration = duration or 4000
    })
end

Last updated