mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-09-04 16:23:21 +00:00
Merge branch 'main' into main
This commit is contained in:
+1
-1
@@ -208,7 +208,7 @@ end, 'admin')
|
||||
-- Inventory (should be in qb-inventory?)
|
||||
|
||||
QBCore.Commands.Add('clearinv', 'Clear Players Inventory (Admin Only)', { { name = 'id', help = 'Player ID' } }, false, function(source, args)
|
||||
local playerId = args[1] and args[1] ~= '' or source
|
||||
local playerId = args[1] ~= '' and args[1] or source
|
||||
local Player = QBCore.Functions.GetPlayer(tonumber(playerId))
|
||||
if Player then
|
||||
Player.Functions.ClearInventory()
|
||||
|
||||
@@ -204,6 +204,7 @@ end)
|
||||
|
||||
QBCore.Functions.CreateCallback('QBCore:HasItem', function(source, cb, items, amount)
|
||||
local retval = false
|
||||
if items == nil then return cb(true) end
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
if not Player then return cb(false) end
|
||||
local isTable = type(items) == 'table'
|
||||
|
||||
+4
-2
@@ -82,7 +82,7 @@ function QBCore.Player.CheckPlayerData(source, PlayerData)
|
||||
PlayerData.charinfo.gender = PlayerData.charinfo.gender or 0
|
||||
PlayerData.charinfo.backstory = PlayerData.charinfo.backstory or 'placeholder backstory'
|
||||
PlayerData.charinfo.nationality = PlayerData.charinfo.nationality or 'USA'
|
||||
PlayerData.charinfo.phone = PlayerData.charinfo.phone or QBCore.Functions.CreatePhoneNumber()
|
||||
PlayerData.charinfo.phone = tonumber(PlayerData.charinfo.phone) or QBCore.Functions.CreatePhoneNumber()
|
||||
PlayerData.charinfo.account = PlayerData.charinfo.account or QBCore.Functions.CreateAccountNumber()
|
||||
-- Metadata
|
||||
PlayerData.metadata = PlayerData.metadata or {}
|
||||
@@ -139,6 +139,7 @@ function QBCore.Player.CheckPlayerData(source, PlayerData)
|
||||
PlayerData.job.name = PlayerData.job.name or 'unemployed'
|
||||
PlayerData.job.label = PlayerData.job.label or 'Civilian'
|
||||
PlayerData.job.payment = PlayerData.job.payment or 10
|
||||
PlayerData.job.type = PlayerData.job.type or 'none'
|
||||
if QBCore.Shared.ForceJobDefaultDutyAtLogin or PlayerData.job.onduty == nil then
|
||||
PlayerData.job.onduty = QBCore.Shared.Jobs[PlayerData.job.name].defaultDuty
|
||||
end
|
||||
@@ -195,6 +196,7 @@ function QBCore.Player.CreatePlayer(PlayerData, Offline)
|
||||
self.PlayerData.job.name = job
|
||||
self.PlayerData.job.label = QBCore.Shared.Jobs[job].label
|
||||
self.PlayerData.job.onduty = QBCore.Shared.Jobs[job].defaultDuty
|
||||
self.PlayerData.job.type = QBCore.Shared.Jobs[job].type or 'none'
|
||||
if QBCore.Shared.Jobs[job].grades[grade] then
|
||||
local jobgrade = QBCore.Shared.Jobs[job].grades[grade]
|
||||
self.PlayerData.job.grade = {}
|
||||
@@ -767,7 +769,7 @@ function QBCore.Functions.CreatePhoneNumber()
|
||||
local UniqueFound = false
|
||||
local PhoneNumber = nil
|
||||
while not UniqueFound do
|
||||
PhoneNumber = math.random(100,999) .. math.random(1000000,9999999)
|
||||
PhoneNumber = tonumber(math.random(100,999) .. math.random(1000000,9999999))
|
||||
local query = '%' .. PhoneNumber .. '%'
|
||||
local result = MySQL.prepare.await('SELECT COUNT(*) as count FROM players WHERE charinfo LIKE ?', { query })
|
||||
if result == 0 then
|
||||
|
||||
Reference in New Issue
Block a user