Hi all, this is another version of !partycheck/!guildcheck. These commands check who are online of the team,
Update log
I hope you like it
Regards
- !partycheck it shows you the members of your party who are online.
- !guildcheck without a param it will print all members of your guild who are online, also you can check the members online of another guild using a param. Example: !guildcheck Legions, if that guild exists it will print all the members who are online of that guild.
Update log
Code:
[B]v1.0 Rev: 2:[/B]
[B]Rev: 2 - [17 / 01 / 2012][/B]
Added better format to show the members.
Fixed some bugs.
Lua:
local function getMembersOnline(tabla)
if (type(tabla) == 'table') then
local nohay = "There are not."
str = "Members list: "..#players.sorcs + #players.druids + #players.paladins + #players.kinas.."\n"
str = str.. "•Sorcerers (".. #players.sorcs.."):\n ".. (#players.sorcs == 1 and players.sorcs[1] or #players.sorcs > 1 and table.concat (players.sorcs, "\n") or nohay).. " \n"
str = str.. "•Druids ("..#players.druids.."):\n ".. (#players.druids == 1 and players.druids[1] or #players.druids > 1 and table.concat (players.druids, "\n") or nohay).. "\n"
str = str.. "•Paladins ("..#players.paladins.."):\n "..(#players.paladins == 1 and players.paladins[1] or #players.paladins > 1 and table.concat (players.paladins, "\n") or nohay).. "\n"
str = str.. "•Knights("..#players.kinas.."):\n ".. (#players.kinas == 1 and players.kinas[1] or #players.kinas > 1 and not table.sort(players.kinas, function (a, b) return (a:match("%d+") < b:match("%d+")) end) and table.concat (players.kinas, "\n") or nohay).."\n"
str = str.. "•The best knights are:\n "..(#players.kinas == 0 and nohay or #players.kinas == 1 and players.kinas[1] or #players.kinas == 2 and players.kinas[1].."\n"..players.kinas[2] or #players.kinas >= 3 and players.kinas[1].."\n"..players.kinas[2] .. "\n"..players.kinas[3])
end
return str
end
local shield = 2511
function onSay(cid, words, param, channel)
if (words == '/guildcheck') then
if (not param or param == "") then
if (getPlayerGuildId(cid) >= 1) then
guildId = getPlayerGuildId(cid)
else
return doPlayerSendCancel(cid, "You are not in a guild.")
end
elseif (getGuildId(param)) then
guildId = getGuildId(param)
else
return doPlayerSendCancel(cid, "There is not exist a guild called "..param..".")
end
players = {}
players.sorcs = {}
players.druids = {}
players.paladins = {}
players.kinas = {}
for _, pid in pairs (getPlayersOnline()) do
if (getPlayerGuildId(pid) == guildId ) then
local str = getPlayerName(pid).. " ["..getPlayerLevel(pid).."]"
if (isSorcerer(pid)) then
table.insert(players.sorcs, str)
elseif (isDruid(pid)) then
table.insert(players.druids, str)
elseif (isPaladin(pid)) then
table.insert(players.paladins, str)
elseif (isKnight(pid)) then
table.insert(players.kinas, str)
end
end
end
doShowTextDialog(cid, shield, "Guild "..param.. " "..getMembersOnline(players))
elseif (words == '/partycheck') then
if (isInParty(cid)) then
players = {}
players.sorcs = {}
players.druids = {}
players.paladins = {}
players.kinas = {}
for _, pid in pairs(getPlayersOnline()) do
if (isInParty(pid) and getPlayerParty(pid) == getPlayerParty(cid)) then
str = getPlayerName(pid).. " ["..getPlayerLevel(pid).."]"
if (isSorcerer(pid)) then
table.insert(players.sorcs, str)
elseif (isDruid(pid)) then
table.insert(players.druids, str)
elseif (isPaladin(pid)) then
table.insert(players.paladins, str)
elseif (isKnight(pid)) then
table.insert(players.kinas, str)
end
end
end
doShowTextDialog(cid, shield, "Party "..getMembersOnline(players))
else
doPlayerSendCancel(cid,"You are not in a party.")
end
end
return true
end
XML:
<talkaction words="!partycheck;!guildcheck" event="script" value="nameofyourscript.lua"/>
I hope you like it
Regards
Last edited: