2013martin1212 Posted October 22, 2016 Share Posted October 22, 2016 i make it finaly with some help the register version but now i get a new problem i cant log in here is my login server side script: addEvent("loginReguest",true) function loginReguest(player,username,password) local check = exports.mysql:_QuerySingle("SELECT * FROM users WHERE username = ? " ,username) if check then local checkPass = check.password if (checkPass == password) then logIn(player,getAccount(username),tostring(password)) triggerClientEvent(player,"showHide", getRootElement()) outputDebugString("User Logged In") end end end addEventHandler("loginReguest",getRootElement(), loginReguest) there is my mysql script : local connection = nil addEventHandler("onResourceStart", resourceRoot, function(resource) connection = dbConnect( "mysql", "dbname=mtalogin;host=localhost", "root", "", "share=1" ) if connection then outputDebugString(getResourceName(resource) .. "Sqlite connection establised!" ) else outputDebugString(getResourceName(resource) .. "Sqlite connection ERROR!") return false end end ) function _Query( ... ) if connection then local query = dbQuery(connection, ... ) local result = dbPoll(query, -1) return result else return false end end function _QuerySingle(str,...) if connection then local result = Query(str,...) if type(result) == 'table' then return result[1] end else return false end end function _Exec(str,...) if connection then local query = dbExec(connection,str,...) return query else return false end end and ther is my debug image Link to comment
Simple0x47 Posted October 22, 2016 Share Posted October 22, 2016 (edited) Be sure that you export the functions on your mysql meta.xml, like this. <export function="_Query" type="server"/> Edited October 22, 2016 by Simple01 Link to comment
2013martin1212 Posted October 22, 2016 Author Share Posted October 22, 2016 thats done yes Link to comment
Simple0x47 Posted October 22, 2016 Share Posted October 22, 2016 Come on man, please try to solve first the problems and when you see that you can't find a solution post it. Please. function _QuerySingle(str,...) if connection then local result = _Query( ... ) --I'd check the parameters what you wanna send if type(result) == 'table' then return result[1] end else return false end end Link to comment
2013martin1212 Posted October 22, 2016 Author Share Posted October 22, 2016 now its says that the dbPool is faild at line 18 function _Query( ... ) if connection then local query = dbQuery(connection, ... ) local result = dbPoll(query, -1) --this line is doent like some reason :( return result else return false end end 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