MetaGamer Posted November 9, 2011 Posted November 9, 2011 I am getting this error attempt to call global 'mysql_connect' (a nil value) client.lua function GameModeInit() con = mysql_connect("204.45.248.18", "", "", "") if(con) then outputChatBox("Connection Success!") else outputChatBox("Connection Failed!") end end addEventHandler("onClientResourceStart", getRootElement(), GameModeInit) mtaserver.config <!-- Specifies the module(s) which are loaded with the server. To load several modules, add more <module> parameter(s). Optional parameter. --> <module src="mta_mysql.dll" /> I have put mta_mysql.dll into the modules folder I have put libmysql.dll in the server folder I also get MODULE: Loaded "MySQL 5.0 database module" (0.50) by "Alberto Alonso <[email protected]>" Might might be the problem?
myonlake Posted November 9, 2011 Posted November 9, 2011 (edited) It was trying to find if(con) function, you had forgotten one space between them. Also I fixed the getRootElement() thing, because otherwise it would of done this script everytime when you start any resource. This new one will do it only if it's this specific resource. function GameModeInit() local con = mysql_connect("204.45.248.18", "", "", "") if (con) then outputChatBox("Connection Success!") else outputChatBox("Connection Failed!") end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), GameModeInit) Edited November 9, 2011 by Guest
MetaGamer Posted November 9, 2011 Author Posted November 9, 2011 It did not fixed. Still the same problem but this time it's only on /debugscript 3, not in serverlog
arezu Posted November 9, 2011 Posted November 9, 2011 /debugscript 3 shows client sided errors, serverlog does not. Also, isn't mysql_connect only server sided?
MetaGamer Posted November 9, 2011 Author Posted November 9, 2011 /debugscript 3 shows client sided errors, serverlog does not. Also, isn't mysql_connect only server sided? Is it? I don't know if it is Clientside or Serverside. There is no documentation on it. Does all modules are serverside?
MetaGamer Posted November 9, 2011 Author Posted November 9, 2011 I have tested in serverside and i works perfectly.
Castillo Posted November 9, 2011 Posted November 9, 2011 Of course it's server side, would be stupid to be in client side, they could see your database username, password and so on.
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