Well, when I was bored, I was thinking a one script that is an implementation of !online command.
This scripts show, each vocation with short vocation value (function getVocShortString(by me)), and sjows how much sorcs, druids, paladins, knight and rookies are online.
Here is an image:
Change the normal !online script to this one:
local config = {
showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}
function getVocShortString(cid) -- function by Xafterin
local string = ""
local tabla = {
[0] = {"N"},
[1] = {"S"},
[2] = {"D"},
[3] = {"P"},
[4] = {"K"},
[5] = {"MS"},
[6] = {"ED"},
[7] = {"RP"},
[8] = {"EK"}
}
local p = tabla[getPlayerVocation(cid)]
if p then
string = p[1]
end
return string
end
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) .. "][".. getVocShortString(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 .. ". ".. sorc .." sorcerers, ".. druid .." druids, ".. paladin .." paladins, ".. knight .." knights and ".. rook .." rookies."
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
end
return true
end
info
Grupo: Banidos
Registrado: 20/11/10
Posts: 35
Reputação: +6
Char no Tibia: Peei
Well, when I was bored, I was thinking a one script that is an implementation of !online command.
This scripts show, each vocation with short vocation value (function getVocShortString(by me)), and sjows how much sorcs, druids, paladins, knight and rookies are online.
Here is an image:
Change the normal !online script to this one:
local config = { showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand')) } function getVocShortString(cid) -- function by Xafterin local string = "" local tabla = { [0] = {"N"}, [1] = {"S"}, [2] = {"D"}, [3] = {"P"}, [4] = {"K"}, [5] = {"MS"}, [6] = {"ED"}, [7] = {"RP"}, [8] = {"EK"} } local p = tabla[getPlayerVocation(cid)] if p then string = p[1] end return string end 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) .. "][".. getVocShortString(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 .. ". ".. sorc .." sorcerers, ".. druid .." druids, ".. paladin .." paladins, ".. knight .." knights and ".. rook .." rookies." end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str) end return true endThat's all!
Editado Novembro 25 por Faisher