mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
Add position parameter and proper debug print
This commit is contained in:
@@ -1,16 +1,28 @@
|
|||||||
local Debug = ESX.GetConfig().EnableDebug
|
local Debug = ESX.GetConfig().EnableDebug
|
||||||
|
|
||||||
|
local possiblePosition = {
|
||||||
|
["top-right"] = true,
|
||||||
|
["top-left"] = true,
|
||||||
|
["top-middle"] = true,
|
||||||
|
["bottom-right"] = true,
|
||||||
|
["bottom-left"] = true,
|
||||||
|
["bottom-middle"] = true,
|
||||||
|
["middle-left"] = true,
|
||||||
|
["middle-right"] = true
|
||||||
|
}
|
||||||
|
|
||||||
---@param notificatonType string the notification type
|
---@param notificatonType string the notification type
|
||||||
---@param length number the length of the notification
|
---@param length number the length of the notification
|
||||||
---@param message any the message :D
|
---@param message any the message :D
|
||||||
---@param title string optional title for the notification
|
---@param title string optional title for the notification
|
||||||
local function Notify(notificatonType, length, message, title)
|
---@param position string optional position for the notification
|
||||||
|
local function Notify(notificatonType, length, message, title, position)
|
||||||
if Debug then
|
if Debug then
|
||||||
print("1 ".. tostring(notificatonType))
|
print("1 ".. tostring(notificatonType))
|
||||||
print("2 "..tostring(length))
|
print("2 "..tostring(length))
|
||||||
print("3 "..message)
|
print("3 "..message)
|
||||||
print("4 "..tostring(title))
|
print("4 "..tostring(title))
|
||||||
|
print("5 "..tostring(position))
|
||||||
end
|
end
|
||||||
|
|
||||||
if type(notificatonType) ~= "string" then
|
if type(notificatonType) ~= "string" then
|
||||||
@@ -21,11 +33,16 @@ local function Notify(notificatonType, length, message, title)
|
|||||||
length = 3000
|
length = 3000
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not possiblePosition[position] then
|
||||||
|
position = Config.position or "middle-right"
|
||||||
|
end
|
||||||
|
|
||||||
if Debug then
|
if Debug then
|
||||||
print("5 ".. tostring(notificatonType))
|
print("6 ".. tostring(notificatonType))
|
||||||
print("6 "..tostring(length))
|
print("7 "..tostring(length))
|
||||||
print("7 "..message)
|
print("8 "..message)
|
||||||
print("8 "..tostring(title))
|
print("9 "..tostring(title))
|
||||||
|
print("10 "..tostring(position))
|
||||||
end
|
end
|
||||||
|
|
||||||
if type(message) == "string" then
|
if type(message) == "string" then
|
||||||
@@ -37,7 +54,7 @@ local function Notify(notificatonType, length, message, title)
|
|||||||
length = length or 5000,
|
length = length or 5000,
|
||||||
message = message or "ESX-Notify",
|
message = message or "ESX-Notify",
|
||||||
title = title or "New Notification",
|
title = title or "New Notification",
|
||||||
position = Config.position or "middle-right",
|
position = position,
|
||||||
notificationSoundEnabled = Config.notificationSoundEnabled or false
|
notificationSoundEnabled = Config.notificationSoundEnabled or false
|
||||||
}))
|
}))
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user