Apparently great minds think alike because after I saw this post a couple days ago, I wrote this out as I was ashamed to see someone trying to charge for this feature. But then I forgot to post it. It seems everyone is shocked at your attempt to charge for one of the most basic things I have seen for sale on here, so far.
So despite other options have been shared, here is mine. It is more lines than needed, to include the notifications that the preview video demonstrated. The video showed console print, chat messages AND native notifications… So I did them all as well, but seriously people, pick one, not all. Why notify locally if there is going to be a global chat message? Makes no sense! But it was in the video… So…
client.lua (Can be replaced with any notify function)
RegisterNetEvent("eventSystem:notify")
AddEventHandler("eventSystem:notify", function(msg)
SetNotificationTextEntry("STRING")
AddTextComponentSubstringPlayerName(msg)
DrawNotification(false, true)
end)
server.lua (With notifications from video)
local event = nil
RegisterCommand("eventstart", function(source)
if event ~= nil then
TriggerClientEvent("eventSystem:notify", source, "~r~[Error]~s~ There's already an event in progress")
else
event = GetEntityCoords(GetPlayerPed(source))
print("New Event: " .. event)
TriggerClientEvent("eventSystem:notify", source, ("~g~[Success]~s~ Event Started at " .. event)
TriggerClientEvent('chat:addMessage', -1, { args = { "Event", "Event Started! Join with /eventtp" }, color = { 255, 0, 0 } })
end
end, true)
RegisterCommand("eventstop", function(source)
if event ~= nil then
TriggerClientEvent("eventSystem:notify", source, "~r~[Error]~s~ There's no active event")
else
event = nil
print("Event Stopped")
TriggerClientEvent("eventSystem:notify", source, "~g~[Success]~s~ Event Stopped")
TriggerClientEvent('chat:addMessage', -1, { args = { "Event", "Event Ended! Thank You For Participating" }, color = { 255, 0, 0 } })
end
end, true)
RegisterCommand("eventreset", function(source)
if event ~= nil then
print("Event Stopped")
end
event = GetEntityCoords(GetPlayerPed(source))
print("New Event: " .. event)
TriggerClientEvent("eventSystem:notify", source, "~g~[Success]~s~ Event Reset to " .. event)
TriggerClientEvent('chat:addMessage', -1, { args = { "Event", "Event Restarted! Join with /eventtp" }, color = { 255, 0, 0 } })
end, true)
RegisterCommand("eventtp", function(source)
if event ~= nil then
SetEntityCoords(GetPlayerPed(source), event)
else
TriggerClientEvent("eventSystem:notify", source, "~r~[Error]~s~ There's no active event")
end
end, false)
EDIT: Oh and my solution is also standalone. There is NO reason for ESX to be a requirement. Maybe the OP just did that to use the ESX notification function because they couldn’t write their own?!? Weird!