diff --git a/[esx]/esx_notify/Notify.lua b/[esx]/esx_notify/Notify.lua index 0f5bb58e..ca5e51cc 100644 --- a/[esx]/esx_notify/Notify.lua +++ b/[esx]/esx_notify/Notify.lua @@ -1,13 +1,55 @@ +Debug = false + ---@param type string the notification type ---@param length number the length of the notification ---@param message any the message :D -local function Notify(type, length, message) +local function Notify(notificatonType, length, message) + + if Debug then + print("1 ".. tostring(notificatonType)) + print("1 "..tostring(length)) + print("1 "..message) + end + + if type(notificatonType) ~= "string" then + notificatonType = "info" + end + + if type(length) ~= "number" then + length = 3000 + end + + if Debug then + print("2 ".. tostring(notificatonType)) + print("2 "..tostring(length)) + print("2 "..message) + end + SendNuiMessage(json.encode({ - type = type or "info", + type = notificatonType or "info", length = length or 3000, message = message or "ESX-Notify" })) end + exports('Notify', Notify) RegisterNetEvent("ESX:Notify", Notify) + +if Debug then + RegisterCommand("notify", function() + ESX.ShowNotification('No Waypoint Set.', true, false, 140) + end) + + RegisterCommand("notify1", function() + ESX.ShowNotification("Well ~g~Done~s~!", "success", 3000) + end) + + RegisterCommand("notify2", function() + ESX.ShowNotification("Information Recived", "info", 3000) + end) + + RegisterCommand("notify3", function() + ESX.ShowNotification("You Did something ~r~WRONG~s~!", "error", 3000) + end) +end \ No newline at end of file