2013martin1212 Posted December 6, 2015 Share Posted December 6, 2015 Hello i find my old scriprs and i cant use it anymore because outdated and i thinking to remake it but i stock on some parts please help , about how to replace to the new mysql part i try it on some one but still not works ;( -- Default host = "127.0.0.1" -- Database Host username = "root" -- Database Username password = "" -- Database Password db = "accounts" -- Database ( Where you got your tables ) handler = dbConnect("mysql", host, username, password, db ) if handler then outputChatBox("sikeres csatlakozas") else outputChatBox("nem sikerult csatlakozni a mysql hez!") end addEventHandler("onPlayerJoin", getRootElement(), function() triggerClientEvent(source, "onJoin", getRootElement()) end ) function onLogin ( player, user, pass ) handler = dbConnect("mysql", host, username, password, db ) local login = dbQuery(handler,"SELECT * FROM accounts WHERE AccountName = '"..mysql_escape_string( handler, user ).."' AND Password = '"..mysql_escape_string( handler, md5(pass) ).."';") if login then local rows = mysql_num_rows(login) if rows == 1 then triggerClientEvent( player, "closeWindow", getRootElement() ) outputChatBox("* You successfully logged in your account!", player, 255, 255, 255) spawnPlayer( player, 0,0,3 ) fadeCamera( player, true ) setCameraTarget( player, player ) else outputChatBox("* Login failed!", player, 255, 255, 255) end mysql_free_result(login) end end addEvent( "onLogin", true ) addEventHandler( "onLogin", getRootElement(), onLogin ) Link to comment
2013martin1212 Posted December 8, 2015 Author Share Posted December 8, 2015 22 es sor debug :attempt to call a local 'user' (a string value) Link to comment
Dealman Posted December 8, 2015 Share Posted December 8, 2015 Seems like this uses the MySQL module, do you have this installed? Link to comment
2013martin1212 Posted December 8, 2015 Author Share Posted December 8, 2015 Banger no thats why i try to edit to the new version which doesnt use the modules Link to comment
Dealman Posted December 8, 2015 Share Posted December 8, 2015 Well, if you don't have the module installed, these functions do not exist; mysql_escape_string mysql_num_rows mysql_free_result What code is on Line 22? This? function onLogin ( player, user, pass ) Link to comment
2013martin1212 Posted December 8, 2015 Author Share Posted December 8, 2015 i dont want to use the module i try to make the new version like dbConnect and dbQuery Link to comment
Dealman Posted December 8, 2015 Share Posted December 8, 2015 Yeah, I understood that, I simply said that you still have functions which belong to the MySQL Module in your code. Those will return nil errors because the function doesn't exist. I also need to know what code is on Line 22. Link to comment
2013martin1212 Posted December 9, 2015 Author Share Posted December 9, 2015 This is my 22. line local login = dbQuery(handler,"SELECT * FROM accounts WHERE AccountName = '"..mysql_escape_string( handler, user ).."' AND Password = '"..mysql_escape_string( handler, md5(pass) ).."';") 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