Extrodus
|| Blazera.net ||
How would I use online.lua to show players online in a certain area.
For example:
Players Online in Thais: 35, Venore: 15, Edron:20.
List: (List of players names online as usual)
It would be lovely if someone could edit/make this script for me. I searched all over the forums and couldn't seem to find someone who has requested this sort of thing.
My talkactions/online.lua
Would be greatly appreciated! Thanks in advance.
For example:
Players Online in Thais: 35, Venore: 15, Edron:20.
List: (List of players names online as usual)
It would be lovely if someone could edit/make this script for me. I searched all over the forums and couldn't seem to find someone who has requested this sort of thing.
My talkactions/online.lua
Code:
local config = {
showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}
function onSay(cid, words, param, channel)
local strings, i, position, added = {""}, 1, 1, false
for _, pid in ipairs(getPlayersOnline()) 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
added = false
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
end
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player" .. (i > 1 and "s" or "") .. " 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
Would be greatly appreciated! Thanks in advance.