mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:01:24 +00:00
refactor: small optimization
This commit is contained in:
+6
-5
@@ -5,6 +5,7 @@ QBCore.Player = {}
|
||||
-- Don't touch any of this unless you know what you are doing
|
||||
-- Will cause major issues!
|
||||
|
||||
local resourceName = GetCurrentResourceName()
|
||||
function QBCore.Player.Login(source, citizenid, newData)
|
||||
if source and source ~= '' then
|
||||
if citizenid then
|
||||
@@ -31,7 +32,7 @@ function QBCore.Player.Login(source, citizenid, newData)
|
||||
end
|
||||
return true
|
||||
else
|
||||
QBCore.ShowError(GetCurrentResourceName(), 'ERROR QBCORE.PLAYER.LOGIN - NO SOURCE GIVEN!')
|
||||
QBCore.ShowError(resourceName, 'ERROR QBCORE.PLAYER.LOGIN - NO SOURCE GIVEN!')
|
||||
return false
|
||||
end
|
||||
end
|
||||
@@ -520,9 +521,9 @@ function QBCore.Player.Save(source)
|
||||
metadata = json.encode(PlayerData.metadata)
|
||||
})
|
||||
if GetResourceState('qb-inventory') ~= 'missing' then exports['qb-inventory']:SaveInventory(source) end
|
||||
QBCore.ShowSuccess(GetCurrentResourceName(), PlayerData.name .. ' PLAYER SAVED!')
|
||||
QBCore.ShowSuccess(resourceName, PlayerData.name .. ' PLAYER SAVED!')
|
||||
else
|
||||
QBCore.ShowError(GetCurrentResourceName(), 'ERROR QBCORE.PLAYER.SAVE - PLAYERDATA IS EMPTY!')
|
||||
QBCore.ShowError(resourceName, 'ERROR QBCORE.PLAYER.SAVE - PLAYERDATA IS EMPTY!')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -541,9 +542,9 @@ function QBCore.Player.SaveOffline(PlayerData)
|
||||
metadata = json.encode(PlayerData.metadata)
|
||||
})
|
||||
if GetResourceState('qb-inventory') ~= 'missing' then exports['qb-inventory']:SaveInventory(PlayerData, true) end
|
||||
QBCore.ShowSuccess(GetCurrentResourceName(), PlayerData.name .. ' OFFLINE PLAYER SAVED!')
|
||||
QBCore.ShowSuccess(resourceName, PlayerData.name .. ' OFFLINE PLAYER SAVED!')
|
||||
else
|
||||
QBCore.ShowError(GetCurrentResourceName(), 'ERROR QBCORE.PLAYER.SAVEOFFLINE - PLAYERDATA IS EMPTY!')
|
||||
QBCore.ShowError(resourceName, 'ERROR QBCORE.PLAYER.SAVEOFFLINE - PLAYERDATA IS EMPTY!')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user