Jump to content

Sabre

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Sabre

  1. 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!
  2. So, let's say I have a query in a server-side script. mysql:query_free("SELECT 'column' FROM table WHERE id = '" .. mysql:escape_string(uniqueid) .. "'") And then, I have a dxDrawText line, on a server-side script: dxDrawText("??", tx+150, ty+10, tx+size-500, ty, tocolor(0, 255, 0, 200), 0.7, "bankgothic", "center", "center") I'd like to know how to display the string from the MySQL column, in the dxDrawText string. Can't seem how to figure it out, since one is client side, and one is server side. Anyone know?
×
×
  • Create New...