br99pedro Posted May 9, 2019 Share Posted May 9, 2019 This is my problem ERROR: dayzmode/lib/team/s_team.lua:1: call: failed to call 'dayzconnect:MySQL' ERROR: dayzmode/lib/system/player.lua:1: call: failed to call 'dayzconnect:players' Im using this call ( getResourceFromName ( "dayzconnect" ), "MySQL", 1, "2", "three" ) <export function="MySQL"/> <include resource="dayzmap"/> <include resource="dayzmode"/> <include resource="dayzbase"/> <include resource="dayzcache"/> <include resource="object_preview"/> I do not know what to do anymore Link to comment
br99pedro Posted May 10, 2019 Author Share Posted May 10, 2019 (edited) 1 hora atrás, Tommy. disse: Mostre o recurso dayzconnect Um recurso é uma pasta, o arquivo nela é o class.lua local XML = xmlLoadFile('connect.xml') local SET = xmlNodeGetChildren(XML)[1] local GET = xmlNodeGetAttribute local name,host,user,pass = GET(SET,'name'),GET(SET,'host'),GET(SET,'user'),GET(SET,'pass') xmlUnloadFile(XML) local Connect = Connection('mysql',('dbname=%s;host=%s'):format(name,host),user,pass) if Connect then outputServerLog('Successfully connect to MySQL server!') local mysql = {} mysql.connect = Connect function mysql.query(query,...) local qhandle = Connect:query(query,...) local r1,r2,r3 = qhandle:poll(-1) if not r1 then outputServerLog(('Query failed: errCode: %d - errMsg: %s'):format(r2,r3)) return false end return r1,r2,r3 end function mysql.exec(query,...) return Connect:exec(query,...) end local admin = { 'B95DA274DD099F546BA0C174D4BE1FB3', '8F6BF86822B5B77D4C34DFA249A595B3', 'CF62F88A8428C6B60B4A44E9BB930EB3', '05B31534456419BB563E021D675171A1', '8954600385BB91CF6E860EDE1E8C8292', } function mysql.server() local query = mysql.query('SELECT * FROM `central` WHERE `name` = ?',getServerName()) if query then if query[1] then return query[1] else mysql.exec('INSERT INTO `central` (`name`,`admin`) VALUES (?,?)',getServerName(),toJSON(admin)) return mysql.server() end end end mysql.server = mysql.server() function MySQL() return mysql end else outputServerLog('Couldnt connect to MySQL server!') getThisResource():stop() end e o connect.xml que ele conecta é este <connect> <set name='dayz' host='127.0.0.1' user='root' pass=''/> </connect> <connect> <set name='name' host='127.0.0.1' user='root' pass=''/> </connect> Obviamente eu mudei os nomes da db e a senha pra nao correr risco, mas garanto que está tudo correto no arquivo original. Edited May 10, 2019 by br99pedro 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