xXBoyDarkXx 328 Posted August 15, 2012 Boas pessoal hoje vou-vos deixar uma nova função mysql para adicionarem ao vosso servidor Aqui está o códico: function split(str, delim, maxNb) if str == nil then return str end if string.find(str, delim) == nil then return { str } end if maxNb == nil or maxNb < 1 then maxNb = 0 end local result = {} local pat = "(.-)" .. delim .. "()" local nb = 0 local lastPos for part, pos in string.gfind(str, pat) do nb = nb + 1 result[nb] = part lastPos = pos if nb == maxNb then break end end if nb ~= maxNb then result[nb + 1] = string.sub(str, lastPos) end return resultendmysql_query = function(query) local rt = io.open('CONFIG','r'):read('*all') local pre= string.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4') 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) 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] = b out[t[1][a]] = out[t[1][a]] or {} out[t[1][a]][i-1] = b end) end return outend Créditos EPVP Cumprimentos xXBoyDarkXx Share this post Link to post Share on other sites
Obilivion 183 Posted August 19, 2012 mesmo.. metem coisas nem sabem o que fazem.. http://cyber-gamers.org/public/style_emoticons/default/268839.gif Share this post Link to post Share on other sites
Fábio Pereira 36 Posted August 19, 2012 se espererarem 1º pra ele diser era bom fds andrian def Share this post Link to post Share on other sites
magnatar 1 Posted July 31, 2013 O que faz?Onde se coloca essa nova função? Share this post Link to post Share on other sites