MetaGamer Posted November 9, 2011 Share 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? Link to comment
myonlake Posted November 9, 2011 Share 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 Link to comment
MetaGamer Posted November 9, 2011 Author Share Posted November 9, 2011 where is the space? Link to comment
myonlake Posted November 9, 2011 Share Posted November 9, 2011 Edited and the code should be working. Link to comment
MetaGamer Posted November 9, 2011 Author Share Posted November 9, 2011 ooooh. Thanks i will try it. Link to comment
MetaGamer Posted November 9, 2011 Author Share Posted November 9, 2011 It did not fixed. Still the same problem but this time it's only on /debugscript 3, not in serverlog Link to comment
arezu Posted November 9, 2011 Share Posted November 9, 2011 /debugscript 3 shows client sided errors, serverlog does not. Also, isn't mysql_connect only server sided? Link to comment
MetaGamer Posted November 9, 2011 Author Share 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? Link to comment
MetaGamer Posted November 9, 2011 Author Share Posted November 9, 2011 I have tested in serverside and i works perfectly. Link to comment
Castillo Posted November 9, 2011 Share 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. 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