Please take a look at the Wiki page of the dbPoll function. There it says that it does return a table of results if the poll was successful but it returns false or nil if an API or connection error occured. From the effects that you are seeing, the dbPoll request is successful but empty. Please try this code instead:
addEvent("account:login", true)
addEventHandler("account:login", root, function(thePlayer, username, password)
if not username or not password then return false end
local queryCheck = dbQuery(db, "SELECT * FROM `accounts` WHERE `username` = '" .. username .. "'")
local result = dbPoll(queryCheck, -1)
if result then
for k,row in ipairs(result) do
local hashedPassword = row["password"]
if passwordVerify(password, hashedPassword) then
triggerClientEvent(thePlayer, 'account:succesfullogin', thePlayer)
setElementData(thePlayer, "account:id", row["id"])
setElementData(thePlayer, "account:username", row["username"])
setElementData(thePlayer, "account:email", row["email"])
setElementData(thePlayer, "account:ip", row["ip"])
setElementData(thePlayer, "account:serial", row["serial"])
setTimer(function()
spawnPlayer(thePlayer, 1245.1999511719, 332.5, 19.200000762939)
triggerClientEvent(thePlayer, 'account:switchcamera', thePlayer)
end, 2900, 1)
return;
end
end
triggerClientEvent(thePlayer, 'account:noaccount', thePlayer)
else
print("database error");
--this is where I dont get anything in return (tried putting outputconsole of an error message but i dont get that either)
end
end)