mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-30 01:38:56 +00:00
Merge pull request #718 from uShifty/patch-4
fix: Phone number generation
This commit is contained in:
+2
-2
@@ -56,7 +56,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 {}
|
||||
@@ -634,7 +634,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