Video
Watch Here
Description
The FiveM Notification Script provides a flexible and powerful notification system fully compatible with the ESX and QBCore frameworks. It allows server administrators and developers to create customized notifications for their players that are both informative and visually appealing. This script is ideal for any type of FiveM server, enhancing the user experience with clear and eye-catching notifications.
Features
- Compatibility: Fully compatible with ESX and QBCore frameworks.
- Variety of Notification Types: Offers pre-configured notification types such as info, success, error, warning, and more.
- Custom Notifications: Ability to create your own notification types with custom icons and sounds.
- Attractive Animations: Visually appealing animations for showing and hiding notifications.
- Blinking Icons: Icons that blink to attract player attention.
- Flexible Positioning: Freely position notifications on the screen (top-left, top-right, center, bottom-left, bottom-right).
- Sound Support: Plays sounds that correspond to each notification type.
- Multi-language Support: Supports multiple languages (English and German by default, easily extendable).
- Configurable Duration: Set the display duration for each notification individually.
- Prioritization: Notifications can be sorted by priority to highlight important messages.
Configuration Options
The script is highly configurable, allowing you to customize nearly every aspect of the notifications.
Example Configuration (config.lua
)
Config = {}
Config.Framework = 'esx' -- 'esx' or 'qbcore'
Config.TestCommandName = 'testnotification' -- Command to test notifications
Config.NotificationTypes = {
["check"] = {duration = 3000, sound = 'check.mp3', priority = 1, title = 'Check', icon = 'check.png'},
["info"] = {duration = 3000, sound = 'info.mp3', priority = 2, title = 'Info', icon = 'info.png'},
["ann"] = {duration = 3000, sound = 'announcement.mp3', priority = 3, title = 'Announcement', icon = 'transfer.png'},
["warning"] = {duration = 3000, sound = 'warning.mp3', priority = 4, title = 'Warning', icon = 'warning.png'},
["success"] = {duration = 3000, sound = 'success.mp3', priority = 5, title = 'Success', icon = 'save.png'},
["msg"] = {duration = 3000, sound = 'info.mp3', priority = 2, title = 'Message', icon = 'info.png'},
["twt"] = {duration = 3000, sound = 'info.mp3', priority = 2, title = 'Twitter', icon = 'twitter.png'},
["call"] = {duration = 3000, sound = 'info.mp3', priority = 2, title = 'Call', icon = 'phone.png'},
["venicebank"] = {duration = 3000, sound = 'info.mp3', priority = 2, title = 'Venice Bank', icon = 'megaphone.png'},
["bill"] = {duration = 3000, sound = 'info.mp3', priority = 2, title = 'Bill', icon = 'bill.png'},
["lspd"] = {duration = 3000, sound = 'info.mp3', priority = 2, title = 'LSPD', icon = 'police.png'},
["save"] = {duration = 3000, sound = 'info.mp3', priority = 2, title = 'Save', icon = 'save.png'},
["ems"] = {duration = 3000, sound = 'info.mp3', priority = 2, title = 'EMS', icon = 'hospital.png'},
["error"] = {duration = 3000, sound = 'error.mp3', priority = 6, title = 'Error', icon = 'error.png'},
["custom1"] = {duration = 5000, sound = 'custom1.mp3', priority = 3, title = 'Custom Notification 1', icon = 'custom1.png'},
["custom2"] = {duration = 5000, sound = 'custom2.mp3', priority = 3, title = 'Custom Notification 2', icon = 'custom2.png'}
}
Config.NotificationPositions = {
["top-left"] = {x = "10px", y = "10px"},
["top-right"] = {x = "calc(100% - 310px)", y = "10px"},
["center"] = {x = "50%", y = "50%", transform = "translate(-50%, -50%)"},
["bottom-left"] = {x = "10px", y = "calc(100% - 110px)"},
["bottom-right"] = {x = "calc(100% - 310px)", y = "calc(100% - 110px)"}
}
Config.DefaultPosition = "top-left" -- Default notification position
Config.DefaultSound = 'info.mp3' -- Default sound for notifications
Config.DefaultStyle = {backgroundColor = 'rgba(0, 0, 0, 0.85)', textColor = 'white'}
Config.Languages = {
en = {
check = "Check",
info = "Info",
ann = "Announcement",
warning = "Warning",
success = "Success",
error = "Error"
},
de = {
check = "Überprüfung",
info = "Info",
ann = "Ankündigung",
warning = "Warnung",
success = "Erfolg",
error = "Fehler"
}
}
function getLocalizedText(type, lang)
lang = lang or 'en'
return Config.Languages[lang][type] or type
end
Usage
Client Script
To use the notification system in a client script, you can use TriggerEvent
to display a notification.
Example
-- Display an informational notification
TriggerEvent('notification:show', 'info', 'This is an informational message', 5000, 'top-right')
-- Example for an error notification
TriggerEvent('notification:show', 'error', 'This is an error message', 3000, 'bottom-left')
-- Example for a custom notification
TriggerEvent('notification:show', 'custom1', 'This is a custom notification', 7000, 'center')
Server Script
To use the notification system in a server script, you can use exports
to send a notification to a specific client.
Example
-- Send a notification to a specific player
local playerId = 1 -- Example player ID
exports['cc_notification']:sendNotification(playerId, 'info', 'This is an informational message', 5000, 'top-right')
-- Example for an error notification
exports['cc_notification']:sendNotification(playerId, 'error', 'This is an error message', 3000, 'bottom-left')
-- Example for a custom notification
exports['cc_notification']:sendNotification(playerId, 'custom1', 'This is a custom notification', 7000, 'center')
Benefits
- Easy Installation and Configuration: Quick and easy to install, with clear and straightforward configuration.
- Visually Appealing: Enhanced user experience through attractive and animated notifications.
- Flexible and Extensible: Customize the system to your specific needs and extend it with custom notification types and styles.
- Multi-language Support: Supports multiple languages and can be easily extended to include additional languages.
Customer Support
- Documentation: Detailed documentation to guide you through installation and configuration.
- Support: Fast and friendly customer service to help you with any questions or issues.
- Updates: Regular updates and improvements to ensure your notification system is always up-to-date.
Subscription-based | |
---|---|
Requirements | |
Code is accessible | |
Support | |
Lines (approximately) | 500 |