Postado Fevereiro 16, 2016 9 anos Oi pessoal, eu tenho um meu ot server tfs1.2 o comando !online, porem ele mostra todos os players que estão online... eu gostaria que mostrasse somente o total de players online, ao inves de mostrar 1 por 1 Agradeço desde já, aqui embaixo esta o script que uso Spoiler function onSay(cid, words, param) local player = Player(cid) local hasAccess = player:getGroup():getAccess() local players = Game.getPlayers() local playerCount = Game.getPlayerCount() player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, playerCount .. " players online.") setPlayerStorageValue(cid, 27099, 0) local i = 0 local msg = "" for k, tmpPlayer in ipairs(players) do if hasAccess or not tmpPlayer:isInGhostMode() then if i > 0 then msg = msg .. ", " end msg = msg .. tmpPlayer:getName() .. " [" .. tmpPlayer:getLevel() .. "]" i = i + 1 end if i == 10 then if k == playerCount then msg = msg .. "." else msg = msg .. "," end player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg) msg = "" i = 0 end end if i > 0 then msg = msg .. "." player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg) end return false end
Postado Fevereiro 16, 2016 9 anos Solução Spoiler function onSay(cid, words, param) local player = Player(cid) local playerCount = Game.getPlayerCount() player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, playerCount .. " players online.") return false end
Postado Fevereiro 16, 2016 9 anos Lobo, se eu mudar para "doPlayerSendTextMessage" algo assim, funciona para o TFS 0.4 ou também precisa alterar a linha "Game.getPlayerCount"? Agradeço xD
Postado Fevereiro 16, 2016 9 anos sim, pra TFS 0.4 ficaria assim: Spoiler function onSay(cid, words, param) local playerCount = #getPlayersOnline() doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, playerCount .. " players online.") return false end
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.