GTX Posted March 16, 2012 Posted March 16, 2012 (edited) Hello, I tried to move from SQLite to MySQL, like: addEvent("onMapStarting", true) addEventHandler("onMapStarting", root, function(mapInfo, mapOptions, gameOptions) g_MapInfo = mapInfo mapname2 = g_MapInfo.name olddata = executeSQLQuery("SELECT playerName, timeText, playerSerial FROM `race maptimes Freeroam "..mapname2.."`") if olddata then for i, v in ipairs">ipairs">ipairs">ipairs">ipairs">ipairs">ipairs(olddata) do Date2 = getRealTime() Date = string.format("%02d/%02d/%02d", Date2.monthday, Date2.month + 1, Date2.year + 1900) outputChatBox("RETURNS: ".. tostring">tostring">tostring">tostring(olddata.playerName) .. ", ".. tostring">tostring">tostring">tostring">tostring(olddata.timeText) ..", ".. tostring">tostring">tostring(olddata.playerSerial) ..".") --mysql_query(connect_mysql, "INSERT INTO `"..mapname.."` (name, Time, Date, Serail, CTag) VALUES ('"..tostring(olddata.playerName).."', '"..tostring(olddata.timeText).."', '"..Date.."', '"..tostring(olddata.playerSerial).."','CLAN')") end end end) Returns nil I've no idea why. Do you know? EDIT: There's freaky bug in ... addEvent("onMapStarting", true) addEventHandler("onMapStarting", root, function(mapInfo, mapOptions, gameOptions) g_MapInfo = mapInfo mapname2 = g_MapInfo.name olddata = executeSQLQuery("SELECT playerName, timeText, playerSerial FROM `race maptimes Freeroam "..mapname2.."`") if olddata then for i, v in ipairs(olddata) do Date2 = getRealTime() Date = string.format("%02d/%02d/%02d", Date2.monthday, Date2.month + 1, Date2.year + 1900) outputChatBox("RETURNS: ".. tostring(olddata.playerName) .. ", ".. tostring(olddata.timeText) ..", ".. tostring(olddata.playerSerial) ..".") end end end) Thanks in advance Edited March 16, 2012 by Guest Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
Kenix Posted March 16, 2012 Posted March 16, 2012 What return nil? request? Can you please tabulate code. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
GTX Posted March 16, 2012 Author Posted March 16, 2012 addEvent("onMapStarting", true) addEventHandler("onMapStarting", root, function(mapInfo, mapOptions, gameOptions) g_MapInfo = mapInfo mapname2 = g_MapInfo.name olddata = executeSQLQuery("SELECT playerName, timeText, playerSerial FROM `race maptimes Freeroam "..mapname2.."`") if olddata then for i, v in ipairs(olddata) do Date2 = getRealTime() Date = string.format("%02d/%02d/%02d", Date2.monthday, Date2.month + 1, Date2.year + 1900) outputChatBox("RETURNS: ".. tostring(olddata.playerName) .. ", ".. tostring(olddata.timeText) ..", ".. tostring(olddata.playerSerial) ..".") end end end) Why don't you test it? tostring(olddata.playerName), tostring(olddata.timeText), tostring(olddata.playerSerial) return nil Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
Cadu12 Posted March 16, 2012 Posted March 16, 2012 olddata = executeSQLQuery("SELECT playerName, timeText, playerSerial FROM `race maptimes Freeroam "..mapname2.."`") I tinhk that's wrong at FROM. Ingame nick: Cadu12
GTX Posted March 16, 2012 Author Posted March 16, 2012 And what it should be? I think it's fine here. Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
GTX Posted March 16, 2012 Author Posted March 16, 2012 I made it working. Thank you for trying to help me. Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
drk Posted March 16, 2012 Posted March 16, 2012 For who don't know: Correct olddata = executeSQLQuery [[ SELECT playerName, timeText, playerSerial FROM myTable WHERE myMap = 'race maptimes Freeroam "..mapname2.."' ]] Or: olddata = executeSQLQuery ( "SELECT playerName, timeText, playerSerial FROM myTable WHERE myMap = 'race maptimes Freeroam "..mapname2.."' ") EPT Team Server Development: 0% Learning C++ | C++ is amazing
GTX Posted March 16, 2012 Author Posted March 16, 2012 Nah, it wasn't that. The problem was: tostring(olddata.playerName), tostring(olddata.timeText), tostring(olddata.playerSerial) to: tostring(v.playerName), tostring(v.timeText), tostring(v.playerSerial) Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
drk Posted March 16, 2012 Posted March 16, 2012 olddata = executeSQLQuery("SELECT playerName, timeText, playerSerial FROM `race maptimes Freeroam "..mapname2.."`")I tinhk that's wrong at FROM. I'm talking about this. EPT Team Server Development: 0% Learning C++ | C++ is amazing
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