henriques. 99 Posted June 2, 2014 Onde poderei arranjar o mysql_qyery do Mijago para por o Top15 in-game com a quest do PACIFICADOR? Cumprimentos, HenriqueSoares Share this post Link to post Share on other sites
0 Karbust 1,143 Posted June 2, 2014 usa a questlib do mijago, procura no Google ke encontras Share this post Link to post Share on other sites
0 Morfo69 66 Posted June 2, 2014 Penso que seja esta, mysql_query = function(query) if not pre then local rt = io.open('CONFIG','r'):read('*all') pre,_= string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4') end math.randomseed(os.time()) local fi,t,out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{} -- os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi) -- für MySQL51 os.execute('mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) -- für MySQL55 for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'t')) end; os.remove(fi); for i = 2, table.getn(t) do table.foreach(t[i],function(a,b) out[i-1] = out[i-1] or {} out[i-1][a] = tonumber(b) or b or 'NULL' out[t[1][a]] = out[t[1][a]] or {} out[t[1][a]][i-1] = tonumber(b) or b or 'NULL' end) end return outend Share this post Link to post Share on other sites
0 henriques. 99 Posted June 2, 2014 Penso que seja esta, mysql_query = function(query) if not pre then local rt = io.open('CONFIG','r'):read('*all') pre,_= string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4') end math.randomseed(os.time()) local fi,t,out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{} -- os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi) -- für MySQL51 os.execute('mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) -- für MySQL55 for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'t')) end; os.remove(fi); for i = 2, table.getn(t) do table.foreach(t[i],function(a,b) out[i-1] = out[i-1] or {} out[i-1][a] = tonumber(b) or b or 'NULL' out[t[1][a]] = out[t[1][a]] or {} out[t[1][a]][i-1] = tonumber(b) or b or 'NULL' end) end return outend Onde adiciono isso? Se for incomodo, deixa lá :)Cumprimentos,Henrique Soares Share this post Link to post Share on other sites
0 Morfo69 66 Posted June 2, 2014 Onde adiciono isso? Se for incomodo, deixa lá :)Cumprimentos,Henrique Soares questlib.lua Share this post Link to post Share on other sites
0 henriques. 99 Posted June 2, 2014 mysql_query = function(query)if not pre thenlocal rt = io.open('CONFIG','r'):read('*all')pre,_= string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4')endmath.randomseed(os.time())local fi,t,out = 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{}-- os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi) -- für MySQL51os.execute('mysql '..pre..' -e'..string.format('%q',query)..' > '..fi) -- für MySQL55for av in io.open(fi,'r'):lines() do table.insert(t,split(av,'t')) end; os.remove(fi);for i = 2, table.getn(t) do table.foreach(t[i],function(a,b)out[i-1] = out[i-1] or {}out[i-1][a] = tonumber(b) or b or 'NULL'out[t[1][a]] = out[t[1][a]] or {}out[t[1][a]][i-1] = tonumber(b) or b or 'NULL'end) endreturn outend onde está em negruto leva aquele ")" ? Share this post Link to post Share on other sites
Onde poderei arranjar o mysql_qyery do Mijago para por o Top15 in-game com a quest do PACIFICADOR?
Cumprimentos,
HenriqueSoares
Share this post
Link to post
Share on other sites