you don't get the account name, you compare it directly with the player's account, for this, get the account name with getAccountName
in the same way, change the playerAccount to accName in the query you sent.
function recordarData()
local playerAccount = getPlayerAccount(source)
if(playerAccount) then
if(isGuestAccount(playerAccount)) then return end
end
local x, y, z = getElementPosition(source)
local money = getPlayerMoney(source)
local health = getElementHealth(source)
local dimension = getElementDimension(source)
local interior = getElementInterior(source)
local accName = getAccountName(playerAccount) --get player's account name to compare in mysql
--Use dbQuery instead of _Exec --replace this with account name
local sendInfo = exports.mysql:_Query("UPDATE characters SET x=?, y=?, z=?, money=?, health=?, dimension=?, interior=?, WHERE cuenta=?", x, y, z, money, health, dimension, interior, accName)
if (sendInfo) then
iprint("Data saved")
else
iprint("Error saving")
end
end
addEventHandler("onPlayerQuit", getRootElement(), recordarData)