Postado Dezembro 21, 2012 12 anos Usa esse que eu utilizo no meu sv. local config = { showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand')) } function onSay(cid, words, param, channel) local players = getPlayersOnline() local strings = {""} local sorc,druid,paladin,knight,rook = 0,0,0,0,0 local i, position = 1, 1 local added = false for _, pid in ipairs(players) do -- Implementacion por Xafterin. if isSorcerer(pid) then sorc = sorc + 1 elseif isDruid(pid) then druid = druid + 1 elseif isPaladin(pid) then paladin = paladin + 1 elseif isKnight(pid) then knight = knight + 1 elseif isRookie(pid) then rook = rook + 1 end --- if(added) then if(i > (position * 7)) then strings[position] = strings[position] .. "," position = position + 1 strings[position] = "" else strings[position] = i == 1 and "" or strings[position] .. ", " end end if((config.showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]" i = i + 1 added = true else added = false end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, (i - 1) .. " Baiak-Sky server:") for i, str in ipairs(strings) do if(str:sub(str:len()) ~= ",") then str = str .. ". ".. sorc .." sorcerer, ".. druid .." druid, ".. paladin .." paladin, ".. knight .." knight jogando atualmente!" end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, str) end return true end em talkactions.xml <talkaction words="!online" event="script" value="online.lua"/> Att, Skyligh Entrada Como Membro 14 / 08 / 2012 Entrada Como Suporte 05 / 12 / 2012 Saída Como Suporte 06 / 01 / 2013 Contato : [email protected] / [email protected]
Postado Dezembro 21, 2012 12 anos Autor Usa esse que eu utilizo no meu sv. local config = { showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand')) } function onSay(cid, words, param, channel) local players = getPlayersOnline() local strings = {""} local sorc,druid,paladin,knight,rook = 0,0,0,0,0 local i, position = 1, 1 local added = false for _, pid in ipairs(players) do -- Implementacion por Xafterin. if isSorcerer(pid) then sorc = sorc + 1 elseif isDruid(pid) then druid = druid + 1 elseif isPaladin(pid) then paladin = paladin + 1 elseif isKnight(pid) then knight = knight + 1 elseif isRookie(pid) then rook = rook + 1 end --- if(added) then if(i > (position * 7)) then strings[position] = strings[position] .. "," position = position + 1 strings[position] = "" else strings[position] = i == 1 and "" or strings[position] .. ", " end end if((config.showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]" i = i + 1 added = true else added = false end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, (i - 1) .. " Baiak-Sky server:") for i, str in ipairs(strings) do if(str:sub(str:len()) ~= ",") then str = str .. ". ".. sorc .." sorcerer, ".. druid .." druid, ".. paladin .." paladin, ".. knight .." knight jogando atualmente!" end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, str) end return true end em talkactions.xml <talkaction words="!online" event="script" value="online.lua"/> Eu prefiro o meu, mas vlw por tentar ajudar... O meu so ta faltando um detalhe de mostrar quantitativo final de players online!
Postado Dezembro 21, 2012 12 anos @Markin tenta assim . local item = 1740 function onSay(cid, words, param, channel) if isSorcerer(pid) then sorc = sorc + 1 elseif isDruid(pid) then druid = druid + 1 elseif isPaladin(pid) then paladin = paladin + 1 elseif isKnight(pid) then knight = knight + 1 elseif isRookie(pid) then rook = rook + 1 end local name,voc,level = "","",0 for _,on in pairs (getPlayersOnline()) do name, voc, level = getCreatureName(on), getPlayerVocationName(on), getPlayerLevel(on) if ( isSorcerer(on)) then table.insert(sorcs, name.. " ["..level.."]" ) elseif ( isDruid(on)) then table.insert(druids, name.. " ["..level.."]") elseif (isPaladin(on)) then table.insert(pallies, name.. " ["..level.."]") elseif (isKnight(cid)) then table.insert(kinas, name.. " ["..level.."]") end local np = "There are not players." local str = "Players List: \n" for i, str in ipairs(strings) do if(str:sub(str:len()) ~= ",") then str = str .. ". ".. sorc .." sorcerer, ".. druid .." druid, ".. paladin .." paladin, ".. knight .." knight jogando atualmente!" doShowTextDialog(cid, item, str) end return true end end end Att, Skyligh Entrada Como Membro 14 / 08 / 2012 Entrada Como Suporte 05 / 12 / 2012 Saída Como Suporte 06 / 01 / 2013 Contato : [email protected] / [email protected]
Postado Dezembro 22, 2012 12 anos Autor @Markin tenta assim . local item = 1740 function onSay(cid, words, param, channel) if isSorcerer(pid) then sorc = sorc + 1 elseif isDruid(pid) then druid = druid + 1 elseif isPaladin(pid) then paladin = paladin + 1 elseif isKnight(pid) then knight = knight + 1 elseif isRookie(pid) then rook = rook + 1 end local name,voc,level = "","",0 for _,on in pairs (getPlayersOnline()) do name, voc, level = getCreatureName(on), getPlayerVocationName(on), getPlayerLevel(on) if ( isSorcerer(on)) then table.insert(sorcs, name.. " ["..level.."]" ) elseif ( isDruid(on)) then table.insert(druids, name.. " ["..level.."]") elseif (isPaladin(on)) then table.insert(pallies, name.. " ["..level.."]") elseif (isKnight(cid)) then table.insert(kinas, name.. " ["..level.."]") end local np = "There are not players." local str = "Players List: \n" for i, str in ipairs(strings) do if(str:sub(str:len()) ~= ",") then str = str .. ". ".. sorc .." sorcerer, ".. druid .." druid, ".. paladin .." paladin, ".. knight .." knight jogando atualmente!" doShowTextDialog(cid, item, str) end return true end end end [22/12/2012 00:39:25] [Error - TalkAction Interface] [22/12/2012 00:39:25] data/talkactions/scripts/online.lua:onSay [22/12/2012 00:39:25] Description: [22/12/2012 00:39:25] data/talkactions/scripts/online.lua:19: bad argument #1 to 'insert' (table expected, got nil) [22/12/2012 00:39:25] stack traceback: [22/12/2012 00:39:25] [C]: in function 'insert' [22/12/2012 00:39:25] data/talkactions/scripts/online.lua:19: in function <data/talkactions/scripts/online.lua:3>
Postado Dezembro 22, 2012 12 anos Tenta assim: [paste]esnNHt1W[/paste] Bruno Carvalho / Ex-Administrador TibiaKing [email protected] Em 26/12/2016 em 03:47, Spraypaint disse: A força da alienação vem dessa fragilidade dos indivíduos, quando apenas conseguem identificar o que os separa e não o que os une. -miltinho
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.