mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 02:01:33 +00:00
chore(oxmysql): Replace fetch
This commit is contained in:
@@ -160,7 +160,7 @@ function QBCore.Functions.IsWhitelisted(source)
|
||||
local plicense = QBCore.Functions.GetIdentifier(src, 'license')
|
||||
local identifiers = GetPlayerIdentifiers(src)
|
||||
if QBCore.Config.Server.whitelist then
|
||||
local result = exports.oxmysql:fetchSync('SELECT * FROM whitelist WHERE license = ?', { plicense })
|
||||
local result = exports.oxmysql:executeSync('SELECT * FROM whitelist WHERE license = ?', { plicense })
|
||||
if result[1] then
|
||||
for _, id in pairs(identifiers) do
|
||||
if result[1].license == id then
|
||||
@@ -269,7 +269,7 @@ function QBCore.Functions.IsPlayerBanned(source)
|
||||
local retval = false
|
||||
local message = ''
|
||||
local plicense = QBCore.Functions.GetIdentifier(src, 'license')
|
||||
local result = exports.oxmysql:fetchSync('SELECT * FROM bans WHERE license = ?', { plicense })
|
||||
local result = exports.oxmysql:executeSync('SELECT * FROM bans WHERE license = ?', { plicense })
|
||||
if result[1] then
|
||||
if os.time() < result[1].expire then
|
||||
retval = true
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ end)
|
||||
-- Get permissions on server start
|
||||
|
||||
CreateThread(function()
|
||||
local result = exports.oxmysql:fetchSync('SELECT * FROM permissions', {})
|
||||
local result = exports.oxmysql:executeSync('SELECT * FROM permissions', {})
|
||||
if result[1] then
|
||||
for k, v in pairs(result) do
|
||||
QBCore.Config.Server.PermissionList[v.license] = {
|
||||
|
||||
+6
-6
@@ -9,7 +9,7 @@ function QBCore.Player.Login(source, citizenid, newData)
|
||||
local src = source
|
||||
if src then
|
||||
if citizenid then
|
||||
local result = exports.oxmysql:fetchSync('SELECT * FROM players WHERE citizenid = ?', { citizenid })
|
||||
local result = exports.oxmysql:executeSync('SELECT * FROM players WHERE citizenid = ?', { citizenid })
|
||||
local PlayerData = result[1]
|
||||
if PlayerData then
|
||||
PlayerData.money = json.decode(PlayerData.money)
|
||||
@@ -525,7 +525,7 @@ end
|
||||
|
||||
QBCore.Player.LoadInventory = function(PlayerData)
|
||||
PlayerData.items = {}
|
||||
local result = exports.oxmysql:fetchSync('SELECT * FROM players WHERE citizenid = ?', { PlayerData.citizenid })
|
||||
local result = exports.oxmysql:executeSync('SELECT * FROM players WHERE citizenid = ?', { PlayerData.citizenid })
|
||||
if result[1] then
|
||||
if result[1].inventory then
|
||||
plyInventory = json.decode(result[1].inventory)
|
||||
@@ -623,7 +623,7 @@ function QBCore.Player.CreateCitizenId()
|
||||
local CitizenId = nil
|
||||
while not UniqueFound do
|
||||
CitizenId = tostring(QBCore.Shared.RandomStr(3) .. QBCore.Shared.RandomInt(5)):upper()
|
||||
local result = exports.oxmysql:fetchSync('SELECT COUNT(*) as count FROM players WHERE citizenid = ?', { CitizenId })
|
||||
local result = exports.oxmysql:executeSync('SELECT COUNT(*) as count FROM players WHERE citizenid = ?', { CitizenId })
|
||||
if result[1].count == 0 then
|
||||
UniqueFound = true
|
||||
end
|
||||
@@ -637,7 +637,7 @@ function QBCore.Player.CreateFingerId()
|
||||
while not UniqueFound do
|
||||
FingerId = tostring(QBCore.Shared.RandomStr(2) .. QBCore.Shared.RandomInt(3) .. QBCore.Shared.RandomStr(1) .. QBCore.Shared.RandomInt(2) .. QBCore.Shared.RandomStr(3) .. QBCore.Shared.RandomInt(4))
|
||||
local query = '%' .. FingerId .. '%'
|
||||
local result = exports.oxmysql:fetchSync('SELECT COUNT(*) as count FROM `players` WHERE `metadata` LIKE ?', { query })
|
||||
local result = exports.oxmysql:executeSync('SELECT COUNT(*) as count FROM `players` WHERE `metadata` LIKE ?', { query })
|
||||
if result[1].count == 0 then
|
||||
UniqueFound = true
|
||||
end
|
||||
@@ -651,7 +651,7 @@ function QBCore.Player.CreateWalletId()
|
||||
while not UniqueFound do
|
||||
WalletId = 'QB-' .. math.random(11111111, 99999999)
|
||||
local query = '%' .. WalletId .. '%'
|
||||
local result = exports.oxmysql:fetchSync('SELECT COUNT(*) as count FROM players WHERE metadata LIKE ?', { query })
|
||||
local result = exports.oxmysql:executeSync('SELECT COUNT(*) as count FROM players WHERE metadata LIKE ?', { query })
|
||||
if result[1].count == 0 then
|
||||
UniqueFound = true
|
||||
end
|
||||
@@ -665,7 +665,7 @@ function QBCore.Player.CreateSerialNumber()
|
||||
while not UniqueFound do
|
||||
SerialNumber = math.random(11111111, 99999999)
|
||||
local query = '%' .. SerialNumber .. '%'
|
||||
local result = exports.oxmysql:fetchSync('SELECT COUNT(*) as count FROM players WHERE metadata LIKE ?', { query })
|
||||
local result = exports.oxmysql:executeSync('SELECT COUNT(*) as count FROM players WHERE metadata LIKE ?', { query })
|
||||
if result[1].count == 0 then
|
||||
UniqueFound = true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user