How to Integrate Your Custom Notification Script

How to Integrate Your Custom Notification Script (Old & New File Structure)

Custom notifications help enhance player experience by using personalized or visually styled messages. Below are the instructions for both the old integration method using editable_client.lua and the new method using bridge/frameworks/client/[framework].lua files (esx.lua or qb.lua depending on your framework).


🔄 New Files: Using bridge/frameworks/client/esx.lua or qb.lua

This is the recommended method for newer versions of the script.

Step 1: Locate the Framework File

Access Your Server Files: Connect via FTP or a file manager.

Navigate to the Notification File: Go to the following directory based on your framework: resources/[your_script]/bridge/frameworks/client/ Open either esx.lua or qb.lua depending on what your server uses.

Step 2: Find the madCore.showNotify Function

Search for this function inside the file:

madCore.showNotify = function(msg)
    -- Default notification logic here
end

This function is called internally whenever the script needs to display a notification.

Step 3: Replace It With Your Custom Notification Script

Example using okokNotify:

madCore.showNotify = function(msg)
    exports['okokNotify']:Alert('Alert', msg, 3000, 'info', true)
end

You can modify it to fit any custom notification script (e.g., mythic_notify, ox_lib, etc.).

Step 4: Test the Integration

  • Restart your server.

  • Trigger an event that sends a notification.

  • Verify that the custom notification appears in-game.


🗂️ Old Files: Using editable_client.lua

This method was used in older versions of the script for managing notifications.

Step 1: Locate editable_client.lua

  • Access your server files via FTP or a file manager.

  • Navigate to the directory where your client scripts are located.

  • Open editable_client.lua using a text editor like Notepad++ or VS Code.

Step 2: Find the ShowNotification Function

Search for this default notification function:

function ShowNotification(msg)
    SetNotificationTextEntry('STRING')
    AddTextComponentString(msg)
    DrawNotification(false, true)
end

Step 3: Integrate Your Custom Notification

Replace the contents of the function with your custom notification script. For example, using okokNotify:

function ShowNotification(msg)
    exports['okokNotify']:Alert('Alert', msg, 3000, 'info', true)
end

Save the file after making changes.

Step 4: Test Your Integration

  • Restart your server.

  • Perform any action that triggers a notification.

  • Confirm that your custom notification is working in-game.


⚠️ Troubleshooting & Best Practices

  • Notification Not Showing? Ensure the custom script is installed, started in server.cfg, and referenced properly.

  • Console Errors? Check the F8 client console or server logs for syntax or export-related errors.

  • Performance Issues? Optimize the custom script and test for any FPS drops or delays.

  • Make Backups: Always back up original files before editing them.

  • Check Docs: Refer to your custom notification script's documentation for detailed usage instructions.

Last updated