papam77 Posted July 15, 2013 Share Posted July 15, 2013 local serverContainer = {} serverContainer.Settings = {} serverContainer.Settings.user = 'zahrej' serverContainer.Settings.pass = 'hahahah no' serverContainer.Settings.host = 'mysql.mmhost.eu' serverContainer.Settings.name = 'zahrej' serverContainer.startResource = function() local connection = dbConnect('mysql', 'dbname='..serverContainer.Settings.name..';host='..serverContainer.Settings.host, serverContainer.Settings.user, serverContainer.Settings.pass) if connection then outputDebugString('Could connect to the mysql server') serverContainer.connection = connection; else outputDebugString('Couldn\'t connect to the mysql server') end end addEventHandler('onResourceStart', resourceRoot, serverContainer.startResource) serverContainer.loginClient = function(user, pass) local qh = dbQuery(serverContainer.connection,'SELECT * FROM _cwa_users WHERE username = ?',user) local result, row, errmsg = dbPoll ( qh, 5000 ) if row > 0 then for id, result in ipairs(result) do local salt = result['salt'] local username = result['username'] local password = result['password'] if salt and username and password then local newPass = md5(md5(salt):lower()..md5(pass):lower()):lower() if newPass == password then triggerClientEvent(source,'onClientSuccessfullyLogin',source) outputChatBox('#ff6666[sERVER]#ffffff You have successfully login.', source,1,1,1,true) else outputChatBox('#ff6666[sERVER]#ffffff This account doesn\'t exists or the password is wrong.', source,1,1,1,true) end end end end end addEvent('onClientLogins', true) addEventHandler('onClientLogins', root, serverContainer.loginClient) My Tables in mysql: name password What i must change? Because it is writing couldn't connect. Link to comment
Castillo Posted July 15, 2013 Share Posted July 15, 2013 The MySQL server details must be wrong. Link to comment
VoltBrad Posted July 15, 2013 Share Posted July 15, 2013 Is it actually displaing 'Couldn't connect to the mysql server'? or some other hidden message? Also where are you running this from? Local? VPS? Gameserver provider? Link to comment
papam77 Posted July 16, 2013 Author Share Posted July 16, 2013 Gamehosting mmhost.eu And i have MySQL by mmhost.eu too. Link to comment
gokalpfirat Posted July 16, 2013 Share Posted July 16, 2013 Try to connect with heidiSQL program first. If cant connect mysql server is local. Link to comment
papam77 Posted July 16, 2013 Author Share Posted July 16, 2013 I am connecting with Navicat MySQL and it works correctly. 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