Kekoo Posted January 31, 2015 Posted January 31, 2015 Hello. Im fixing my server a little bit. And im using this Database ( https://community.multitheftauto.com/in ... ils&id=546 ) And when iv entered everything in ( Cofig/database.cml ) abd starting the script im getting this error code ( ERROR: [Main]\QGdatabase\database.lua:16: attempt to call global 'mysql_connect' (a nil value) ) I would be happy with every answere i can get! So heres the script : -- resource Constants mysqlHandler = nil function loadResource(resource) -- load resource configuration local config = xmlLoadFile("config/database.xml") local host = xmlNodeGetValue(xmlFindChild(config, "host", 0)) local username = xmlNodeGetValue(xmlFindChild(config, "username", 0)) local password = xmlNodeGetValue(xmlFindChild(config, "password", 0)) local database = xmlNodeGetValue(xmlFindChild(config, "database", 0)) local port = xmlNodeGetValue(xmlFindChild(config, "port", 0)) and tonumber(xmlNodeGetValue(xmlFindChild(config, "port", 0))) or nil local socket = xmlNodeGetValue(xmlFindChild(config, "socket", 0)) and xmlNodeGetValue(xmlFindChild(config, "socket", 0)) or nil local flags = xmlNodeGetValue(xmlFindChild(config, "flags", 0)) and xmlNodeGetValue(xmlFindChild(config, "flags", 0)) or nil -- try to connect mysqlHandler = mysql_connect(host, username, password, database, port, socket, flags) if (not mysqlHandler) then -- an error occured during connection outputDebugString("Database connection could not been established.", 1) -- abort resource start-up if (resource == getThisResource()) then cancelEvent(true, "Database connection failed.") end return nil end -- connection succeeded outputDebugString("Database connection established successfully.", 3) return nil end function unloadResource(resource) -- try to close database connection if (not mysqlHandler) then -- no handler to close outputDebugString("Database connection not closed. No connection or connection corrupted.", 2) return nil end mysql_close(mysqlHandler) return nil end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), loadResource, false) addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), unloadResource, false) Thanks For Helping! Cheers!
Gallardo9944 Posted January 31, 2015 Posted January 31, 2015 You require this module: https://wiki.multitheftauto.com/index.ph ... /MTA-MySQL But i'd suggest you to remake the connection to dbConnect and dbQuery stuff, which is native for MTA. Code Debugger - Minimalistic MTA debug line replacement
Kekoo Posted January 31, 2015 Author Posted January 31, 2015 How do you mean with that suggest @Gallardo9944?
ALw7sH Posted January 31, 2015 Posted January 31, 2015 mysql_connect > dbConnect mysql_query > dbQuery etc ..
Kekoo Posted February 1, 2015 Author Posted February 1, 2015 You require this module: https://wiki.multitheftauto.com/index.ph ... /MTA-MySQLBut i'd suggest you to remake the connection to dbConnect and dbQuery stuff, which is native for MTA. I did add exactly this into mtaserverconf ( ) its a windows host. This is how it looks like in the file : -- Specifies the module(s) which are loaded with the server. To load several modules, add more parameter(s). Optional parameter. --> -- --> -- --> -- --> And i did try this tought to : -- Specifies the module(s) which are loaded with the server. To load several modules, add more parameter(s). Optional parameter. --> -- --> -- --> "mta_mysql.dll" /> I still get this Error : ERROR: [Main]\QGdatabase\database.lua:16: attempt to call global 'mysql_connect' (a nil value) mysql_connect > dbConnect mysql_query > dbQuery etc .. And cuz im not a scripter i kinda dont know how to do that
ALw7sH Posted February 1, 2015 Posted February 1, 2015 did you download the module and add it to ur server? (C:\Program files\MTA San Andreas\server\mods\deathmatch\modules\)
Kekoo Posted February 1, 2015 Author Posted February 1, 2015 did you download the module and add it to ur server? (C:\Program files\MTA San Andreas\server\mods\deathmatch\modules\) Yes
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