Jump to content

Winstrol

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Winstrol

  1. db = dbConnect("mysql", "dbname="..xmlNodeGetValue(dbname)..";host="..xmlNodeGetValue(host)..";charset="..xmlNodeGetValue(charset).."", ""..xmlNodeGetValue(user).."", ""..xmlNodeGetValue(pass).."", "share="..xmlNodeGetValue(share).."", "batch="..xmlNodeGetValue(batch).."", "autoreconnect="..xmlNodeGetValue(autorec).."", "log="..xmlNodeGetValue(logs).."")
  2. <config> <dbname>mydb</dbname> <host>127.0.0.1</host> <charset>utf8</charset> <username>root</username> <password></password> <share>1</share> <batch>0</batch> <autoreconnect>1</autoreconnect> <log>1</log> </config>
  3. local loadConfig = xmlLoadFile(":startup/dbconfig.xml", true) local findGroup = xmlFindChild(loadConfig, "config", 0) 7: local dbname = xmlFindChild(findGroup, "dbname", 0) 8: local host = xmlFindChild(findGroup, "host", 0) 9: local charset = xmlFindChild(findGroup, "charset", 0) 10: local user = xmlFindChild(findGroup, "username", 0) 11: local pass = xmlFindChild(findGroup, "password", 0) 12: local share = xmlFindChild(findGroup, "share", 0) 13: local batch = xmlFindChild(findGroup, "batch", 0) 14: local autorec = xmlFindChild(findGroup, "autoreconnect", 0) 15: local logs = xmlFindChild(findGroup, "log", 0) 17: xmlUnloadFile(loadConfig) 19: db = dbConnect("mysql", "dbname="..xmlNodeGetValue(dbname)..";host="..xmlNodeGetValue(host)..";charset="..xmlNodeGetValue(charset).."", ""..xmlNodeGetValue(user).."", ""..xmlNodeGetValue(pass).."", "share="..xmlNodeGetValue(share).."", "batch="..xmlNodeGetValue(batch).."", "autoreconnect="..xmlNodeGetValue(autorec).."", "log="..xmlNodeGetValue(logs).."") My brain explodes
  4. My mistake. Not in the meta.xml file, but in the settings.xml file.
  5. Hello everyone! I'm 100% newbie in Lua coding, I'm trying to learn Lua language. To the point.. I'm trying connect my gamemode to MySQL, but data to connect with database, I want to get from file, or meta.xml. dbname = get("start.dbname") host = get("start.host") charset = get("start.charset") user = get("start.username") pass = get("start.password") share = get("start.share") batch = get("start.batch") autorec = get("start.autoreconnect") logs = get("start.logs") db = dbConnect("mysql", "dbname="..dbname..";host="..host..";charset="..charset.."", ""..user.."", ""..pass.."", "share="..share.."", "batch="..batch.."", "autoreconnect="..autorec.."", "log="..logs.."") Server console shows me an error. My meta.xml <settings> <setting name="dbname" value="database" /> <setting name="host" value="127.0.0.1" /> <setting name="charset" value="utf8" /> <setting name="username" value="root" /> <setting name="password" value="" /> <setting name="share" value="1" /> <setting name="batch" value="0" /> <setting name="autoreconnect" value="1" /> <setting name="log" value="1" /> </settings> I don't have any idea for do this thing. Only one way is xmlFindChild/xmlLoadString, etc.?
×
×
  • Create New...