Skip to content

Commit

Permalink
Merge pull request #1 from Arctos2win/patch-3
Browse files Browse the repository at this point in the history
fix(esx_core): 🔨 send metadata to the client
  • Loading branch information
Mycroft-Studios authored Oct 8, 2024
2 parents d61abc5 + 9bbe1f7 commit 81daabe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions [core]/es_extended/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -708,3 +708,7 @@ end)
ESX.RegisterClientCallback("esx:GetVehicleType", function(cb, model)
cb(ESX.GetVehicleType(model))
end)

RegisterNetEvent('esx:updatePlayerData', function(key, val)
ESX.SetPlayerData(key, val)
end)
3 changes: 2 additions & 1 deletion [core]/es_extended/server/classes/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
self.metadata[index] = type(self.metadata[index]) == "table" and self.metadata[index] or {}
self.metadata[index][value] = subValue
end
self.triggerEvent('esx:updatePlayerData', 'metadata', self.metadata)
end

function self.clearMeta(index, subValues)
Expand Down Expand Up @@ -870,7 +871,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
else
return print(("[^1ERROR^7] xPlayer.clearMeta ^5subValues^7 should be ^5string^7 or ^5table^7, received ^5%s^7!"):format(type(subValues)))
end

self.triggerEvent('esx:updatePlayerData', 'metadata', self.metadata)
end

for fnName, fn in pairs(targetOverrides) do
Expand Down

0 comments on commit 81daabe

Please sign in to comment.