BumbiS* Posted July 17, 2011 Share Posted July 17, 2011 (edited) Hey, users. I have a problem here, its about login with mysql. It shows a error and i cant fix it, thats why i'm asking for help. So here's the code function loginHandler(parole) if parole then if (client) then local res = mysql_query(sqlConnection,"SELECT * FROM users WHERE Name='"..getPlayerName(source).."' AND Pass='"..parole.."'") if res then if(mysql_num_rows(res)>0) then while true do local row = mysql_fetch_assoc(res) if(not row) then break end spawn(client) setPlayerMoney(client,row["Money"]) setElementModel(client,row["Skin"]) end mysql_free_result(res) else outputChatBox("Nepareiza parole!",source) triggerClientEvent("ShowLoginGUI",client) end end end else outputChatBox("Ievadiet paroli.",client) triggerClientEvent("ShowLoginGUI",client) end end And the error Error: server.lua:71: attempt to concatenate a boolean value this is the error line local res = mysql_query(sqlConnection,"SELECT * FROM users WHERE Name='"..getPlayerName(source).."' AND Pass='"..parole.."'") Edited July 17, 2011 by Guest Link to comment
Slothman Posted July 17, 2011 Share Posted July 17, 2011 whats triggering this function, and more to the point, how is it getting "source" ? Link to comment
BumbiS* Posted July 17, 2011 Author Share Posted July 17, 2011 (edited) GUI is triggering it from client side. function clientSubmitLogin(button,state) if button == "left" and state == "up" then local parole = guiGetText(edtUser) if parole then triggerServerEvent("submitLogin", getRootElement(), parole) guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) else outputChatBox("Lūdzu ievadiet paroli.") end end end amm.. i thought that source is always the element who triggers the function. FIXED!!!! I just add a trigger argument to the event and used it as player variable. Now it works well. Thanks for responses. Edited July 17, 2011 by Guest Link to comment
Aibo Posted July 17, 2011 Share Posted July 17, 2011 and here the source is the root element, read triggerServerEvent Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now