'PACI 2,317 Posted May 12, 2016 local lines = {} for line in io.read("usage.txt") do table.insert(lines, line) end local currentData = lines[table.getn(lines)] if not currentData or currentData == "" then currentData = lines[table.getn(lines)-1] end local tokens = string.split(currentData, "|") -- {string.match(currentData, (string.gsub(currentData, "[^|]*|", "([^|]*)|")))} local averageVal = tonumber(tokens[3]) local maxVal = tonumber(tokens[4]) say("Em média há "..averageVal.." jogadores conectados.") say("No máximo houve "..maxVal.." jogadores conectados.") Salvo erro a lua 5.0 tem a função string.match(). Se não tiver basta usar esta função: function string:split(inSplitPattern, outResults) if not outResults then outResults = {} end local theStart = 1 local theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) while theSplitStart do table.insert( outResults, string.sub( self, theStart, theSplitStart-1 ) ) theStart = theSplitEnd + 1 theSplitStart, theSplitEnd = string.find( self, inSplitPattern, theStart ) end table.insert( outResults, string.sub( self, theStart ) ) return outResults end 2 [DEV]Runah and Wolvarinhas reacted to this Share this post Link to post Share on other sites
anime107 2 Posted May 18, 2016 queria uma quest para quando todos os jogadores entrassem no jogo tivesse uma missão que ao clicar nela saberia quantas pesssoas estão online no servidor, tipo o comando /w de gmxD Share this post Link to post Share on other sites
anime107 2 Posted June 9, 2016 must start with 'quest'online_count.quest:1:Abort (core dumped) Share this post Link to post Share on other sites