mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:08:57 +00:00
Update the way jobrep metadata is handled
When you add a new job, existing players cannot get jobrep for it because the original jobrep metadata is always loaded instead. With this method, existing players can get jobrep for new jobs. This checks to make sure that jobrep metadata isn't nil so that new players do not get stuck in an infinite loop, and instead creates new jobrep metadata for them. There may be a better way to do this, but this works.
This commit is contained in:
+15
-6
@@ -80,12 +80,21 @@ function QBCore.Player.CheckPlayerData(source, PlayerData)
|
||||
PlayerData.metadata['craftingrep'] = PlayerData.metadata['craftingrep'] or 0
|
||||
PlayerData.metadata['attachmentcraftingrep'] = PlayerData.metadata['attachmentcraftingrep'] or 0
|
||||
PlayerData.metadata['currentapartment'] = PlayerData.metadata['currentapartment'] or nil
|
||||
PlayerData.metadata['jobrep'] = PlayerData.metadata['jobrep'] or {
|
||||
['tow'] = 0,
|
||||
['trucker'] = 0,
|
||||
['taxi'] = 0,
|
||||
['hotdog'] = 0,
|
||||
}
|
||||
if PlayerData.metadata['jobrep'] ~= nil then
|
||||
PlayerData.metadata['jobrep'] = {
|
||||
['tow'] = PlayerData.metadata['jobrep']['tow'] or 0,
|
||||
['trucker'] = PlayerData.metadata['jobrep']['trucker'] or 0,
|
||||
['taxi'] = PlayerData.metadata['jobrep']['taxi'] or 0,
|
||||
['hotdog'] = PlayerData.metadata['jobrep']['hotdog'] or 0,
|
||||
}
|
||||
else
|
||||
PlayerData.metadata['jobrep'] = {
|
||||
['tow'] = 0,
|
||||
['trucker'] = 0,
|
||||
['taxi'] = 0,
|
||||
['hotdog'] = 0,
|
||||
}
|
||||
end
|
||||
PlayerData.metadata['callsign'] = PlayerData.metadata['callsign'] or 'NO CALLSIGN'
|
||||
PlayerData.metadata['fingerprint'] = PlayerData.metadata['fingerprint'] or QBCore.Player.CreateFingerId()
|
||||
PlayerData.metadata['walletid'] = PlayerData.metadata['walletid'] or QBCore.Player.CreateWalletId()
|
||||
|
||||
Reference in New Issue
Block a user