Thanks for responding, myonlake, but I'm having trouble with the query, and this is the error I get in the console.
Here's the whole function from s_test.Lua, so you can see maybe if I screwed anything up?
addCommandHandler("testsql",
function(player, cmd, uniqueid)
local uniqueid = tonumber(uniqueid)
if uniqueid then
local query = mysql:query("SELECT username FROM accounts WHERE id = '" .. (uniqueid) .. "'")
if query then
triggerClientEvent(player, "onDataSelect", player, query.username)
else
outputChatBox("MySQL error.", player, 255, 0, 0, false)
end
else
outputChatBox("Syntax: /" .. cmd .. " [unique id]", player, 255, 180, 0, false)
end
end
)
And then here's the whole function from c_test.Lua, didn't really change anything here, but still.
addEvent("onDataSelect", true)
addEventHandler("onDataSelect", root,
function(username)
_username = username
addEventHandler("onClientRender", root, showUsername)
if isTimer(datatimer) then killTimer(datatimer) end
datatimer = setTimer(function()
removeEventHandler("onClientRender", root, showUsername)
end, 6500, 1)
end
)
function showUsername()
dxDrawText("Fetched username: " .. _username, tx+150, ty+10, tx+size-500, ty, tocolor(0, 255, 0, 200), 0.7, "bankgothic", "center", "center", false, true, true, false, true)
end
And here's a screenshot of the accounts table, the ID and the username are right next to each other, all of the mysql is properly configured and all that.
When I typed /testsql 1 in-game, it didn't display anything in-game, not even an error, just the error I posted in the console.
I would really appreciate it if you could point me in the right direction, or see if I'm messing up the query somehow?
Thanks!