Skip to content

Commit

Permalink
fix: revert changes to all other core files
Browse files Browse the repository at this point in the history
  • Loading branch information
mafewtm committed Oct 27, 2024
1 parent ca07475 commit fe904e5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion config/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ return {
---@param player Player Player object
---@param payment number Payment amount
sendPaycheck = function (player, payment)
AddMoney(player.PlayerData.source, 'bank', payment)
player.Functions.AddMoney('bank', payment)
Notify(player.PlayerData.source, locale('info.received_paycheck', payment))
end,
}
8 changes: 4 additions & 4 deletions server/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ lib.addCommand('givemoney', {
return
end

AddMoney(args[locale('command.givemoney.params.id.name')], args[locale('command.givemoney.params.moneytype.name')], args[locale('command.givemoney.params.amount.name')])
player.Functions.AddMoney(args[locale('command.givemoney.params.moneytype.name')], args[locale('command.givemoney.params.amount.name')])
end)

lib.addCommand('setmoney', {
Expand All @@ -221,7 +221,7 @@ lib.addCommand('setmoney', {
return
end

SetMoney(args[locale('command.setmoney.params.id.name')], args[locale('command.setmoney.params.moneytype.name')], args[locale('command.setmoney.params.amount.name')])
player.Functions.SetMoney(args[locale('command.setmoney.params.moneytype.name')], args[locale('command.setmoney.params.amount.name')])
end)

lib.addCommand('job', {
Expand All @@ -246,7 +246,7 @@ lib.addCommand('setjob', {
return
end

local success, errorResult = SetJob(args[locale('command.setjob.params.id.name')], args[locale('command.setjob.params.job.name')], args[locale('command.setjob.params.grade.name')] or 0)
local success, errorResult = player.Functions.SetJob(args[locale('command.setjob.params.job.name')], args[locale('command.setjob.params.grade.name')] or 0)
assert(success, json.encode(errorResult))
end)

Expand Down Expand Up @@ -327,7 +327,7 @@ lib.addCommand('setgang', {
return
end

local success, errorResult = SetGang(args[locale('command.setgang.params.id.name')], args[locale('command.setgang.params.gang.name')], args[locale('command.setgang.params.grade.name')] or 0)
local success, errorResult = player.Functions.SetGang(args[locale('command.setgang.params.gang.name')], args[locale('command.setgang.params.grade.name')] or 0)
assert(success, json.encode(errorResult))
end)

Expand Down
8 changes: 4 additions & 4 deletions server/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ AddEventHandler('playerDropped', function(reason)
color = 'red',
message = ('**%s** (%s) left...\n **Reason:** %s'):format(GetPlayerName(src), player.PlayerData.license, reason),
})
Save(src --[[@as Source]])
player.Functions.Save()
QBX.Player_Buckets[player.PlayerData.license] = nil
QBX.Players[src] = nil
end)
Expand Down Expand Up @@ -188,10 +188,10 @@ RegisterNetEvent('QBCore:ToggleDuty', function()
local player = GetPlayer(src)
if not player then return end
if player.PlayerData.job.onduty then
SetJobDuty(src, false)
player.Functions.SetJobDuty(false)
Notify(src, locale('info.off_duty'))
else
SetJobDuty(src, true)
player.Functions.SetJobDuty(true)
Notify(src, locale('info.on_duty'))
end
end)
Expand All @@ -207,7 +207,7 @@ local function playerStateBagCheck(bagName, meta, value)
local player = QBX.Players[plySrc]
if not player then return end
if player.PlayerData.metadata[meta] == value then return end
SetMetadata(plySrc, meta, value)
player.Functions.SetMetaData(meta, value)
end

---@diagnostic disable-next-line: param-type-mismatch
Expand Down
2 changes: 1 addition & 1 deletion server/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ function ToggleOptin(source)
if not license or not IsPlayerAceAllowed(source --[[@as string]], 'admin') then return end
local player = GetPlayer(source)
player.PlayerData.optin = not player.PlayerData.optin
SetPlayerData(source, 'optin', player.PlayerData.optin)
player.Functions.SetPlayerData('optin', player.PlayerData.optin)
end

exports('ToggleOptin', ToggleOptin)
Expand Down
6 changes: 3 additions & 3 deletions server/loops.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ local function removeHungerAndThirst(src, player)
local newHunger = playerState.hunger - config.player.hungerRate
local newThirst = playerState.thirst - config.player.thirstRate

SetMetadata(player.PlayerData.source, 'thirst', math.max(0, newThirst))
SetMetadata(player.PlayerData.source, 'hunger', math.max(0, newHunger))
player.Functions.SetMetaData('thirst', math.max(0, newThirst))
player.Functions.SetMetaData('hunger', math.max(0, newHunger))

Save(player.PlayerData.source)
player.Functions.Save()
end

CreateThread(function()
Expand Down

0 comments on commit fe904e5

Please sign in to comment.