So I'm making a vehicle system with SQL, it's finished but the thing is that when I buy the vehicle, move and hide it then spawn it, it does what it's supposed to do, but the second time I do it, it doesn't work anymore. To clarify, my account name is addaccount. I believe it has something to do with the Affected rows: 0.
2016-12-17 23:35:22.292: [script] SUCCESS: Affected rows:0 [Query:UPDATE addaccount SET veh='Buccaneer', x=2140.720703, y=-1117.307617, z=24.937660, rot=264.001465, bp=5000, ups='asd', plate='90QK LL8', hp=1000, fuel=0, lock=0, r=255, g=255, b=255 WHERE num='75834']
Here's the code of the hide function
function hideVehicle(player)
if (isGuestAccount(player.account)) then return end
if (not isElement(vehs[player])) then return end
local num = vehs[player]:getData("num")
local veh = vehs[player].name
local xe, ye, ze = getElementPosition(vehs[player])
local xr, yr, rot = getElementRotation(vehs[player])
local r, g, b = getVehicleColor(vehs[player], true)
local lock = getElementData(vehs[player], "lock")
local ups = getVehicleUpgrades(vehs[player])
outputChatBox(num..veh..xe..ye..ze..rot..r..g..b..lock)
local query = "UPDATE "..player.account.name.." SET veh=?, x=?, y=?, z=?, rot=?, bp=?, ups=?, plate=?, hp=?, fuel=?, lock=?, r=?, g=?, b=? WHERE num=?"
dbExec(con, query, veh, xe, ye, ze, rot, 5000, "asd", vehs[player].plateText, vehs[player].health, vehs[player]:getData("fuel"), lock, r, g, b, num)
destroyElement(vehs[player])
vehs[player] = nil
return true
end
addCommandHandler("hide", hideVehicle)