improvement(server/functions): Send full queries with MySQL.store

This commit is contained in:
Linden
2021-06-21 15:15:06 +10:00
committed by GitHub
parent d13bac5807
commit a1686651c2
+10 -11
View File
@@ -165,7 +165,7 @@ end
local savePlayers = -1
Citizen.CreateThread(function()
savePlayers = MySQL.Sync.store("UPDATE users SET ? WHERE ?")
savePlayers = MySQL.Sync.store("UPDATE users SET `accounts` = ?, `job` = ?, `job_grade` = ?, `group` = ?, `position`= ?, `inventory`, = ?, `loadout` = ? WHERE `identifier` = ?")
end)
ESX.SavePlayer = function(xPlayer, cb)
@@ -173,15 +173,14 @@ ESX.SavePlayer = function(xPlayer, cb)
table.insert(asyncTasks, function(cb2)
MySQL.Async.execute(savePlayers, {
{
['accounts'] = json.encode(xPlayer.getAccounts(true)),
['job'] = xPlayer.job.name,
['job_grade'] = xPlayer.job.grade,
['group'] = xPlayer.getGroup(),
['loadout'] = json.encode(xPlayer.getLoadout(true)),
['position'] = json.encode(xPlayer.getCoords()),
['inventory'] = json.encode(xPlayer.getInventory(true))
}, {['identifier'] = xPlayer.getIdentifier()}
json.encode(xPlayer.getAccounts(true)),
xPlayer.job.name,
xPlayer.job.grade,
xPlayer.getGroup(),
json.encode(xPlayer.getCoords()),
json.encode(xPlayer.getInventory(true)),
json.encode(xPlayer.getLoadout(true)),
xPlayer.getIdentifier()
}, function(rowsChanged)
cb2()
end)
@@ -251,7 +250,7 @@ end
ESX.GetIdentifier = function(playerId)
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license') then
if string.match(v, 'license:') then
local identifier = string.gsub(v, 'license:', '')
return identifier
end