Tenho esse comando aqui de online


Tenho esse comando aqui de online
Assim vai funcionar:
local config = { showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand')) } function onSay(cid, words, param, channel) local players = getPlayersOnline() local strings = {""} local i, position = 1, 1 local added = false local vocations = { [0] = "None", [1] = "S", [2] = "D", [3] = "P", [4] = "K", [5] = "MS", [6] = "ED", [7] = "RP", [8] = "EK", } for _, pid in ipairs(players) do 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) .. ", " .. vocations[getPlayerVocation(pid)] .. "]" i = i + 1 added = true else added = false end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) online:") for i, str in ipairs(strings) do if(str:sub(str:len()) ~= ",") then str = str .. "." end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str) end return true end
--- Você tem que usar uma tabela para colocar qual vai ser o nome das vocações
--Edit: Cometi um erro
Era só pegar o script e colar ou tinha que alterar algo?
eu colei e deu esse error :
Você colocou depois de eu arrumar o script? (do meu edit?)
sim
Eu editei de novo... Eu não consegui colocar a ultima parte (a de mostrar quantos kinas/sorc/blabla estão online) Amanhã eu edito de novo.
Sem pressa, tu é foda cara
Galera, quero o script ainda, peguei o do incur e outro que achei aqui e tentei fazer
ele ficou assim :
Editado:
local config = { showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand')) } local function getAccessName(pid) local name = "" local access = getPlayerAccess(pid) if (access == 0) then name = "Player" elseif access == 1 then name = "Tutor" elseif access == 2 then name = "S.Tutor" elseif access == 3 then name = "GM" elseif access == 4 then name = "CM" elseif access == 5 then name = "GOD" else return false end return name end function onSay(cid, words, param, channel) local players = getPlayersOnline() local strings = {""} local stringsx = {""} local sorc,druid,paladin,knight,rook = 0,0,0,0,0 local staff = 0 local i, j, position, positionx = 1, 1, 1, 1 local added = false local addedx = false local vocations = { [0] = "None", [1] = "S", [2] = "D", [3] = "P", [4] = "K", [5] = "MS", [6] = "ED", [7] = "RP", [8] = "EK", } 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 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))) and not (getPlayerAccess(pid) > 0)) then strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. ", " .. vocations[getPlayerVocation(pid)] .. "]" i = i + 1 added = true else added = false end end for _, pid in ipairs(players) do if (getPlayerAccess(pid) > 0) then if(addedx) then if(j > (positionx * 7)) then stringsx[positionx] = stringsx[positionx] .. "," positionx = positionx + 1 stringsx[positionx] = "" else stringsx[positionx] = j == 1 and "" or stringsx[positionx] .. ", " 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 stringsx[positionx] = stringsx[positionx] .. getCreatureName(pid) .. " [" .. getAccessName(pid) .. "]" j = j + 1 addedx = true else addedx = false end end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) online:") for i, str in ipairs(strings) do if(str:sub(str:len()) ~= ",") then str = str .. "\n" .. sorc .." sorcerers, ".. druid .." druids, ".. paladin .." paladins e ".. knight .." knights." end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Tem " .. (j - 1) .. " staff online:") for j, strx in ipairs(stringsx) do if(strx:sub(strx:len()) ~= ",") then strx = strx .. "." end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, strx) end return true end
quase perfeito, só ficou ruim a parte dos staffs
eu mudei algumas coisas ao meu gosto ficou assim
e se um player normal desse online mesmo tendo staff online aparece
Tópico movido para a seção de dúvidas e pedidos resolvidos.
Alguns dos meus trabalhos no fórum
Projeto Tutores de Scripting (encerrado)
Evento Blood Castle Automático
Killua Task System
Killua Automatic Raids System
Função AccountStorageValue
Player Pull Action (puxar jogador)
NPC Trocador - Troca itens por outros (SIMPLIFICADO)
Teleportar Membros Da Guild Para Seu Lado
Itens Ganhando Exp e Upando (Upgrade System)
Como usar addEvent - Tutorial
Sistema de Cultivo (Plantação)
Cart System (Andar de carrinho)