2013martin1212 Posted October 25, 2016 Share Posted October 25, 2016 local handler = dbConnect( "mysql", "dbname=mtalogin;host=localhost", "root", "", "share=1" ) if handler then outputChatBox("sikeres csatlakozas") end function loginReguest( thePlayer, username, password ) if thePlayer and username and password then if getElementType(thePlayer) == "player" then -- account data -- local account = dbQuery(handler, "SELECT * FROM users WHERE username='" .. username .. "'") if account then local data = dbPoll( account, -1 ) for i, sor in ipairs(data) do if sor["password"] == password then outputChatBox("a") -- character data -- local character = dbQuery(handler, "SELECT * FROM characters WHERE accountname = ?", username "'") setElementData(thePlayer, "acc:adminLevel", sor["adminLevel"]) if character then local adatok = dbPoll(character, -1) for i, sor in ipairs(adatok) do setElementData(thePlayer, "acc:username", username) --spawnPlayer(source, sor["posX"], sor["poY"], sor["poZ"]) spawnPlayer (thePlayer, 0, 0, 5, 0, math.random (0,288), 0, 0) -- spawns player with random skin end end end end end end end end addEvent("logIn", true) addEventHandler("logIn", getRootElement(), loginReguest) 3rd day i try to figure out how i can make a login with mysql perfect but alway got an error please someone push me true this process Link to comment
pa3ck Posted October 25, 2016 Share Posted October 25, 2016 Do you even read your code and debugscript? local character = dbQuery(handler, "SELECT * FROM characters WHERE accountname = ?", username "'") Tell me what's wrong with that line of code, read it carefully. 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