DevLog #2 - Starting Notifications
Hello, again!
We created a simple notification system, what uses Bulletin.
This script have a lot of configuration, but yet just a simple standalone script.
Later we want to re-coding to ESX Legacy…
A little sneek peak (not all the code):
-- Normal Notification
RegisterCommand('example', function(source, args)
if allowedToUse then
exports.bulletin:SendAdvanced({
message = table.concat(args, " "),
title = "EXAMPLE JOB",
subject = "Notification",
timeout = 5000,
theme = 'info',
icon = 'CHAR_CALL911',
exitAnim = 'fadeOut'
})
else
exports.bulletin:SendError("ERROR MESSAGE HERE", 5000)
end
end, false)
-- Pinned notification with UniqueID
RegisterCommand('examplepin', function(source, args)
if allowedToUse then
local id = exports.bulletin:SendPinned({
message = table.concat(args, " "),
title = "EXAMPLE JOB",
subject = "Pinned Notification",
timeout = 5000,
theme = 'info',
type = 'advanced',
icon = 'CHAR_CALL911',
exitAnim = 'fadeOut'
})
if pinnedMessages.EXAMPLEID == nil then
pinnedMessages.EXAMPLEID = {id}
else
table.insert(pinnedMessages.EXAMPLEID, id)
end
else
exports.bulletin:SendError("ERROR MESSAGE HERE", 5000)
end
end, false)
RegisterCommand("removeEXAMPLEpin", function(source, args)
if pinnedMessages.EXAMPLEID ~= nil then
exports.bulletin:Unpin(pinnedMessages.EXAMPLEID)
end
end, false)
Future plans for this code:
- Creating a configurable message system for ESX Legacy (config.lua)
- Creating a multilanguage system for this script
- Creating a modified configuration for all jobs
We prepared for the future…
With love, Ben from Summerfall Interactive Team.