How to Integrate Your Custom Notification Script

To integrate your custom notification script into our system, you'll need to modify the ShowNotification function found in the editable_client.lua file. Follow these steps to ensure your notifications are properly displayed.

Step 1: Locate the editable_client.lua File

  • Access Your Server Files:

    • Connect to your server via FTP or use your file manager.

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

  • Open editable_client.lua:

    • Find and open the editable_client.lua file using a text editor (e.g., Notepad++, VS Code).

Step 2: Find the ShowNotification Function

  • Search for the Function Definition:

    • Look for the ShowNotification function within the editable_client.lua file. This function handles the display of notifications in the script.

Example:

function ShowNotification(msg)
    -- Default notification code
    SetNotificationTextEntry('STRING')
    AddTextComponentString(msg)
    DrawNotification(false, true)
end

Step 3: Integrate Your Custom Notification Script

  • Understand Your Custom Script:

    • Familiarize yourself with the custom notification script you want to integrate. Note how it handles displaying notifications.

  • Modify the ShowNotification Function:

    • Replace or modify the default ShowNotification code to use your custom notification script. Ensure that the function correctly calls your custom notification logic.

Example Integration

function ShowNotification(msg)
    -- Custom notification script code
    exports['okokNotify']:Alert('Alert', msg, 3000, 'info', true)
end
  • Save Your Changes:

    • After integrating your custom notification code, save the changes to editable_client.lua.

Step 4: Test Your Integration

  • Restart Your Server:

    • To apply the changes, restart your server.

  • Trigger Notifications:

    • Test the notification functionality to ensure that your custom script is working as expected.

  • Verify Display:

    • Check the notifications in-game to confirm they appear and behave according to your custom script.

Troubleshooting

  • Notifications Not Appearing: Double-check your integration code for errors. Ensure the custom script is correctly referenced and functioning.

  • Errors in Console: Review any error messages in the server console to diagnose and fix issues with the custom notification script.

  • Performance Issues: Ensure that the custom script is optimized and does not negatively impact server performance.

Additional Tips

  • Backup Before Editing: Always create a backup of the original editable_client.lua file before making changes.

  • Consult Documentation: Refer to your custom notification script's documentation for specific integration instructions and best practices.

Last updated