Skip to content

Developer Guide

API Reference v1.0.0

For Developers

This guide covers all exports and events available in IF Notify. Perfect for integrating with your custom scripts.

Client Export

Use this export in any client-side script to show a notification.

lua
exports['if-notify']:ShowNotification(type, title, message, duration)

Arguments

ArgumentTypeDescription
typestring'success', 'error', 'info', 'warning', 'server' OR a custom type (e.g., 'bank').
titlestringThe main title text.
messagestringThe body message.
durationnumber(Optional) Duration in ms. Default is 5000.

Example

lua
exports['if-notify']:ShowNotification(
    'success',
    'System Access',
    'Welcome back, user.',
    5000
)

Server Event

You can trigger notifications directly from the server.

lua
TriggerClientEvent('if-notify:show', source, type, title, message, duration)

Example (Server-Side)

lua
RegisterCommand('hello', function(source)
    TriggerClientEvent('if-notify:show', source, 'info', 'Hello', 'World from Server!', 3000)
end)

Best Practices

  • ✅ Always validate user input before showing notifications
  • ✅ Use appropriate durations (3000-7000ms recommended)
  • ✅ Don't spam notifications - users will miss important ones
  • ✅ Use custom types for better organization
  • ❌ Avoid showing notifications in tight loops

📝 Complete Example

Here's a real-world example integrating IF Notify with a banking system:

lua
-- Client-side banking transaction
RegisterNetEvent('bank:transaction', function(type, amount)
    local title = type == 'deposit' and 'Bank Deposit' or 'Bank Withdrawal'
    local message = ('$%s has been %s your account'):format(amount, type == 'deposit' and 'added to' or 'withdrawn from')
    
    exports['if-notify']:ShowNotification(
        type == 'deposit' and 'success' or 'warning',
        title,
        message,
        5000
    )
end)

Released under proprietary license.