Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: switch to notify function #243

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ end)
RegisterNetEvent('qbx_core:server:deleteCharacter', function(citizenId)
local src = source
DeleteCharacter(src, citizenId)
TriggerClientEvent('QBCore:Notify', src, Lang:t('success.character_deleted'), 'success')
Notify(src, Lang:t('success.character_deleted'), 'success')
end)
34 changes: 17 additions & 17 deletions server/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ lib.addCommand('tp', {
local coords = GetEntityCoords(target)
TriggerClientEvent('QBCore:Command:TeleportToPlayer', source, coords)
else
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error')
Notify(source, Lang:t('error.not_online'), 'error')
end
else
if args[Lang:t("command.tp.params.x.name")] and args[Lang:t("command.tp.params.y.name")] and args[Lang:t("command.tp.params.z.name")] then
Expand All @@ -24,10 +24,10 @@ lib.addCommand('tp', {
if x ~= 0 and y ~= 0 and z ~= 0 then
TriggerClientEvent('QBCore:Command:TeleportToCoords', source, x, y, z)
else
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.wrong_format'), 'error')
Notify(source, Lang:t('error.wrong_format'), 'error')
end
else
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.missing_args'), 'error')
Notify(source, Lang:t('error.missing_args'), 'error')
end
end
end)
Expand Down Expand Up @@ -60,7 +60,7 @@ lib.addCommand('addpermission', {
local player = GetPlayer(tonumber(args[Lang:t("command.addpermission.params.id.name")]) --[[@as number]])
local permission = tostring(args[Lang:t("command.addpermission.params.permission.name")])
if not player then
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error')
Notify(source, Lang:t('error.not_online'), 'error')
return
end
AddPermission(player.PlayerData.source, permission)
Expand All @@ -77,7 +77,7 @@ lib.addCommand('removepermission', {
local player = GetPlayer(tonumber(args[Lang:t("command.removepermission.params.id.name")]) --[[@as number]])
local permission = tostring(args[Lang:t("command.removepermission.params.permission.name")])
if not player then
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error')
Notify(source, Lang:t('error.not_online'), 'error')
return
end
RemovePermission(player.PlayerData.source, permission)
Expand All @@ -90,12 +90,12 @@ lib.addCommand('openserver', {
restricted = "group.admin"
}, function(source)
if not Config.Server.Closed then
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.server_already_open'), 'error')
Notify(source, Lang:t('error.server_already_open'), 'error')
return
end
if HasPermission(source, 'admin') then
Config.Server.Closed = false
TriggerClientEvent('QBCore:Notify', source, Lang:t('success.server_opened'), 'success')
Notify(source, Lang:t('success.server_opened'), 'success')
else
KickWithReason(source, Lang:t("error.no_permission"), nil, nil)
end
Expand All @@ -109,7 +109,7 @@ lib.addCommand('closeserver', {
restricted = "group.admin"
}, function(source, args)
if Config.Server.Closed then
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.server_already_closed'), 'error')
Notify(source, Lang:t('error.server_already_closed'), 'error')
return
end
if HasPermission(source, 'admin') then
Expand All @@ -121,7 +121,7 @@ lib.addCommand('closeserver', {
KickWithReason(k, reason, nil, nil)
end
end
TriggerClientEvent('QBCore:Notify', source, Lang:t('success.server_closed'), 'success')
Notify(source, Lang:t('success.server_closed'), 'success')
else
KickWithReason(source, Lang:t("error.no_permission"), nil, nil)
end
Expand Down Expand Up @@ -162,7 +162,7 @@ lib.addCommand('givemoney', {
}, function(source, args)
local player = GetPlayer(tonumber(args[Lang:t("command.givemoney.params.id.name")]) --[[@as number]])
if not player then
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error')
Notify(source, Lang:t('error.not_online'), 'error')
return
end
player.Functions.AddMoney(tostring(args[Lang:t("command.givemoney.params.moneytype.name")]), tonumber(args[Lang:t("command.givemoney.params.amount.name")]) --[[@as number]])
Expand All @@ -179,7 +179,7 @@ lib.addCommand('setmoney', {
}, function(source, args)
local player = GetPlayer(tonumber(args[Lang:t("command.setmoney.params.id.name")]) --[[@as number]])
if not player then
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error')
Notify(source, Lang:t('error.not_online'), 'error')
return
end
player.Functions.SetMoney(tostring(args[Lang:t("command.setmoney.params.moneytype.name")]), tonumber(args[Lang:t("command.setmoney.params.amount.name")]) --[[@as number]])
Expand All @@ -190,7 +190,7 @@ lib.addCommand('job', {
help = Lang:t("command.job.help")
}, function(source)
local PlayerJob = GetPlayer(source).PlayerData.job
TriggerClientEvent('QBCore:Notify', source, Lang:t('info.job_info', {value = PlayerJob?.label, value2 = PlayerJob?.grade.name, value3 = PlayerJob?.onduty}))
Notify(source, Lang:t('info.job_info', {value = PlayerJob?.label, value2 = PlayerJob?.grade.name, value3 = PlayerJob?.onduty}))
end)

lib.addCommand('setjob', {
Expand All @@ -204,7 +204,7 @@ lib.addCommand('setjob', {
}, function(source, args)
local player = GetPlayer(tonumber(args[Lang:t("command.setjob.params.id.name")]) --[[@as number]])
if not player then
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error')
Notify(source, Lang:t('error.not_online'), 'error')
return
end
if args[Lang:t("command.setjob.params.grade.name")] then
Expand All @@ -220,7 +220,7 @@ lib.addCommand('gang', {
help = Lang:t("command.gang.help")
}, function(source)
local PlayerGang = GetPlayer(source).PlayerData.gang
TriggerClientEvent('QBCore:Notify', source, Lang:t('info.gang_info', {value = PlayerGang?.label, value2 = PlayerGang?.grade.name}))
Notify(source, Lang:t('info.gang_info', {value = PlayerGang?.label, value2 = PlayerGang?.grade.name}))
end)

lib.addCommand('setgang', {
Expand All @@ -234,7 +234,7 @@ lib.addCommand('setgang', {
}, function(source, args)
local player = GetPlayer(tonumber(args[Lang:t("command.setgang.params.id.name")]) --[[@as number]])
if not player then
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error')
Notify(source, Lang:t('error.not_online'), 'error')
return
end
if args[Lang:t("command.setgang.params.grade.name")] then
Expand Down Expand Up @@ -289,7 +289,7 @@ lib.addCommand('me', {
}, function(source, args)
args[1] = args[Lang:t("command.me.params.message.name")]
args[Lang:t("command.me.params.message.name")] = nil
if #args < 1 then TriggerClientEvent('QBCore:Notify', source, Lang:t('error.missing_args2'), 'error') return end
if #args < 1 then Notify(source, Lang:t('error.missing_args2'), 'error') return end
local msg = table.concat(args, ' '):gsub('[~<].-[>~]', '')
local playerState = Player(source).state
playerState:set('me', msg, true)
Expand Down Expand Up @@ -323,5 +323,5 @@ lib.addCommand('deletechar', {

local citizenId = player.PlayerData.citizenid
ForceDeleteCharacter(citizenId)
TriggerClientEvent('QBCore:Notify', source, Lang:t('success.character_deleted_citizenid', {citizenid = citizenId}))
Notify(source, Lang:t('success.character_deleted_citizenid', {citizenid = citizenId}))
end)
4 changes: 2 additions & 2 deletions server/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ RegisterNetEvent('QBCore:ToggleDuty', function()
if not player then return end
if player.PlayerData.job.onduty then
player.Functions.SetJobDuty(false)
TriggerClientEvent('QBCore:Notify', src, Lang:t('info.off_duty'))
Notify(src, Lang:t('info.off_duty'))
else
player.Functions.SetJobDuty(true)
TriggerClientEvent('QBCore:Notify', src, Lang:t('info.on_duty'))
Notify(src, Lang:t('info.on_duty'))
end
TriggerClientEvent('QBCore:Client:SetDuty', src, player.PlayerData.job.onduty)
end)
4 changes: 2 additions & 2 deletions server/loops.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ end)

local function sendPaycheck(player, payment)
player.Functions.AddMoney('bank', payment)
TriggerClientEvent('QBCore:Notify', player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
Notify(player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
end

local function pay(player)
Expand All @@ -37,7 +37,7 @@ local function pay(player)
return
end
if account < payment then -- Checks if company has enough money to pay society
TriggerClientEvent('QBCore:Notify', player.PlayerData.source, Lang:t('error.company_too_poor'), 'error')
Notify(player.PlayerData.source, Lang:t('error.company_too_poor'), 'error')
return
end
exports['qbx_management']:RemoveMoney(job.name, payment)
Expand Down
Loading