mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
chore: types
mostly types anyway.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---@alias NotificationPosition 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left' | 'center-right' | 'center-left'
|
||||
---@alias NotificationType 'inform' | 'warning' | 'success' | 'error'
|
||||
---@alias NotificationType 'info' | 'warning' | 'success' | 'error'
|
||||
|
||||
---@class NotifyProps
|
||||
---@field id? string
|
||||
@@ -12,7 +12,9 @@
|
||||
---@field icon? string | {[1]: IconProp, [2]: string};
|
||||
---@field iconColor? string;
|
||||
|
||||
---`client`
|
||||
---@param data NotifyProps
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
function lib.notify(data)
|
||||
SendNUIMessage({
|
||||
action = 'notify',
|
||||
@@ -33,7 +35,7 @@ function lib.defaultNotify(data)
|
||||
-- Backwards compat for v3
|
||||
data.type = data.status
|
||||
if data.type == 'inform' then data.type = 'info' end
|
||||
return lib.notify(data)
|
||||
return lib.notify(data --[[@as NotifyProps]])
|
||||
end
|
||||
|
||||
RegisterNetEvent('ox_lib:notify', lib.notify)
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
if GetConvarInt('ox:txAdminNotifications', false) == 1 then
|
||||
if GetConvar('txAdmin-hideDefaultAnnouncement', 'false') == 'true' then
|
||||
AddEventHandler('txAdmin:events:announcement', function(eventData)
|
||||
TriggerClientEvent('ox_lib:notify', -1, {
|
||||
id = 'txAdmin:announcement',
|
||||
title = locale('txadmin_announcement', eventData.author),
|
||||
description = eventData.message,
|
||||
duration = 5000
|
||||
})
|
||||
end)
|
||||
end
|
||||
if GetConvarInt('ox:txAdminNotifications', 0) == 0 then return end
|
||||
|
||||
if GetConvar('txAdmin-hideDefaultDirectMessage', 'false') == 'true' then
|
||||
AddEventHandler('txAdmin:events:playerDirectMessage', function(eventData)
|
||||
TriggerClientEvent('ox_lib:notify', eventData.target, {
|
||||
id = 'txAdmin:playerDirectMessage',
|
||||
title = locale('txadmin_dm', eventData.author),
|
||||
description = eventData.message,
|
||||
duration = 5000
|
||||
})
|
||||
end)
|
||||
end
|
||||
|
||||
if GetConvar('txAdmin-hideDefaultWarning', 'false') == 'true' then
|
||||
AddEventHandler('txAdmin:events:playerWarned', function(eventData)
|
||||
TriggerClientEvent('ox_lib:alertDialog', eventData.target, {
|
||||
header = locale('txadmin_warn', eventData.author),
|
||||
content = locale('txadmin_warn_content', eventData.reason, eventData.actionId),
|
||||
centered = true
|
||||
})
|
||||
end)
|
||||
end
|
||||
|
||||
if GetConvar('txAdmin-hideDefaultScheduledRestartWarning', 'false') == 'true' then
|
||||
AddEventHandler('txAdmin:events:scheduledRestart', function(eventData)
|
||||
TriggerClientEvent('ox_lib:notify', -1, {
|
||||
id = 'txAdmin:scheduledRestart',
|
||||
title = locale('txadmin_scheduledrestart'),
|
||||
description = eventData.translatedMessage,
|
||||
duration = 5000
|
||||
})
|
||||
end)
|
||||
end
|
||||
if GetConvarInt('txAdmin-hideDefaultAnnouncement', 0) == 1 then
|
||||
AddEventHandler('txAdmin:events:announcement', function(eventData)
|
||||
TriggerClientEvent('ox_lib:notify', -1, {
|
||||
id = 'txAdmin:announcement',
|
||||
title = locale('txadmin_announcement', eventData.author),
|
||||
description = eventData.message,
|
||||
duration = 5000
|
||||
})
|
||||
end)
|
||||
end
|
||||
|
||||
if GetConvarInt('txAdmin-hideDefaultDirectMessage', 0) == 1 then
|
||||
AddEventHandler('txAdmin:events:playerDirectMessage', function(eventData)
|
||||
TriggerClientEvent('ox_lib:notify', eventData.target, {
|
||||
id = 'txAdmin:playerDirectMessage',
|
||||
title = locale('txadmin_dm', eventData.author),
|
||||
description = eventData.message,
|
||||
duration = 5000
|
||||
})
|
||||
end)
|
||||
end
|
||||
|
||||
if GetConvarInt('txAdmin-hideDefaultWarning', 0) == 1 then
|
||||
AddEventHandler('txAdmin:events:playerWarned', function(eventData)
|
||||
TriggerClientEvent('ox_lib:alertDialog', eventData.target, {
|
||||
header = locale('txadmin_warn', eventData.author),
|
||||
content = locale('txadmin_warn_content', eventData.reason, eventData.actionId),
|
||||
centered = true
|
||||
})
|
||||
end)
|
||||
end
|
||||
|
||||
if GetConvarInt('txAdmin-hideDefaultScheduledRestartWarning', 0) == 1 then
|
||||
AddEventHandler('txAdmin:events:scheduledRestart', function(eventData)
|
||||
TriggerClientEvent('ox_lib:notify', -1, {
|
||||
id = 'txAdmin:scheduledRestart',
|
||||
title = locale('txadmin_scheduledrestart'),
|
||||
description = eventData.translatedMessage,
|
||||
duration = 5000
|
||||
})
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -202,8 +202,8 @@ local function startCreator(arg, useLast)
|
||||
local rightX, rightY = getRelativePos(vec2(xCoord, yCoord), vec2(xCoord + 2, yCoord), GetGameplayCamRot(2).z)
|
||||
local forwardX, forwardY = getRelativePos(vec2(xCoord, yCoord), vec2(xCoord, yCoord + 2), GetGameplayCamRot(2).z)
|
||||
|
||||
DrawLine(xCoord, yCoord, zCoord, rightX, rightY, zCoord, 0, 255, 0, 225)
|
||||
DrawLine(xCoord, yCoord, zCoord, forwardX, forwardY, zCoord, 0, 255, 0, 225)
|
||||
DrawLine(xCoord, yCoord, zCoord, rightX, rightY or 0, zCoord, 0, 255, 0, 225)
|
||||
DrawLine(xCoord, yCoord, zCoord, forwardX, forwardY or 0, zCoord, 0, 255, 0, 225)
|
||||
end
|
||||
|
||||
DrawLine(xCoord, yCoord, zCoord, xCoord + 2, yCoord, zCoord, 0, 0, 255, 225)
|
||||
@@ -228,6 +228,7 @@ local function startCreator(arg, useLast)
|
||||
|
||||
drawLines()
|
||||
elseif zoneType == 'sphere' then
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
DrawMarker(28, xCoord, yCoord, zCoord, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, height, height, height, 255, 42, 24, 100, false, false, 0, false, false, false, false)
|
||||
end
|
||||
|
||||
@@ -294,7 +295,7 @@ local function startCreator(arg, useLast)
|
||||
newX = 0.0
|
||||
end
|
||||
|
||||
if math.abs(newY) < minCheck then
|
||||
if math.abs(newY or 0) < minCheck then
|
||||
newY = 0.0
|
||||
end
|
||||
|
||||
@@ -319,7 +320,7 @@ local function startCreator(arg, useLast)
|
||||
newX = 0.0
|
||||
end
|
||||
|
||||
if math.abs(newY) < minCheck then
|
||||
if math.abs(newY or 0) < minCheck then
|
||||
newY = 0.0
|
||||
end
|
||||
|
||||
@@ -344,7 +345,7 @@ local function startCreator(arg, useLast)
|
||||
newX = 0.0
|
||||
end
|
||||
|
||||
if math.abs(newY) < minCheck then
|
||||
if math.abs(newY or 0) < minCheck then
|
||||
newY = 0.0
|
||||
end
|
||||
|
||||
@@ -369,7 +370,7 @@ local function startCreator(arg, useLast)
|
||||
newX = 0.0
|
||||
end
|
||||
|
||||
if math.abs(newY) < minCheck then
|
||||
if math.abs(newY or 0) < minCheck then
|
||||
newY = 0.0
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user