SlashBuster Posted April 22, 2012 Posted April 22, 2012 So now I'm quiet close to finish my login/ register script but 1 more problem is there the server is saying that there is an error in line 6 but I think it is right StartServer.lua:6: ')' expected near ',' function loginHandler(username,password) local = connect = dbConnect("mysql", "dbname=mta_userdata;host=127.0.0.1","root","klaas","share=1" ) if (connect,"SELECT (Name,Passwort) FROM `user` WHERE (Name = ?,Passwort = ?)", tostring ( username ), tostring ( password ) ) then spawnPlayer(source, 1959.55, -1714.46, 10) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Willkommen!", source) end else outputChatBox("Invalid username and password. Please re-connect and try again.",source) end end addEvent("submitLogin", true) addEventHandler("submitLogin",getRootElement(),loginHandler)
myonlake Posted April 22, 2012 Posted April 22, 2012 Try this, your script is a mess anyways so I am not assuming this would work anyways. function loginHandler(username, password) local = connect = dbConnect("mysql", "dbname=mta_userdata;host=127.0.0.1", "root", "klaas", "share=1") if connect then local query = dbQuery(connect, "SELECT Name, Passwort FROM `user` WHERE Name = `" .. username .. "`, Passwort = `" .. password .. "`") if query then spawnPlayer(source, 1959.55, -1714.46, 10) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Willkommen!", source, 0, 255, 0, false) else outputChatBox("Invalid username and password. Please reconnect and try again.", source, 255, 0, 0, false) end dbFree(query) end end addEvent("submitLogin", true) addEventHandler("submitLogin", root, loginHandler) If I helped you, please click the like button on the right Thanks!
SlashBuster Posted April 22, 2012 Author Posted April 22, 2012 It works so now I am finished and no it is not a mess because that's my scripting style that is logicly for me ^^
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