Skip to content

Commit

Permalink
feat(server/player): SetCharInfo export
Browse files Browse the repository at this point in the history
  • Loading branch information
mafewtm committed Oct 27, 2024
1 parent 801cd1b commit 2d4c13b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions server/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,25 @@ end

exports('GetMetadata', GetMetadata)

---@param identifier Source | string
---@param charInfo string
---@param value any
function SetCharInfo(identifier, charInfo, value)
if not charInfo or type(charInfo) ~= 'string' then return end

local player = type(identifier) == 'string' and (GetPlayerByCitizenId(identifier) or GetOfflinePlayer(identifier)) or GetPlayer(identifier)

if not player then return end

--local oldCharInfo = player.PlayerData.charinfo[charInfo]

player.PlayerData.charinfo[charInfo] = value

UpdatePlayerData(identifier)
end

exports('SetCharInfo', SetCharInfo)

---@param source Source
---@param playerMoney table
---@param moneyType MoneyType
Expand Down

0 comments on commit 2d4c13b

Please sign in to comment.