• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TalkAction !partycheck-!guildcheck

Jetro

jangeldev
Joined
Aug 1, 2011
Messages
452
Reaction score
68
Location
Venezuela
Hi all, this is another version of !partycheck/!guildcheck. These commands check who are online of the team,
  • !partycheck it shows you the members of your party who are online.
    vLbht.png
  • !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.
    5dWUU.png

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:
Code:
[14:58:14.743] [Error - TalkAction Interface]
[14:58:14.743] data/talkactions/scripts/mtibia/check_party_guild.lua:onSay
[14:58:14.743] Description:
[14:58:14.743] ...ata/talkactions/scripts/mtibia/check_party_guild.lua:7: attempt to index global 'paladins' (a nil value)
[14:58:14.743] stack traceback:
[14:58:14.743]  ...ata/talkactions/scripts/mtibia/check_party_guild.lua:7: in function 'getMembersOnline'
[14:58:14.743]  ...ata/talkactions/scripts/mtibia/check_party_guild.lua:54: in function <...ata/talkactions/scripts/mtibia/check_party_guild.lua:16>

Bug :S?
It is a guild with 129 members and with 30 players online.
 
It works great, I have some miniupdates for the script:

1) When you do !guildcheck guildName it should show on the box the NAME OF THE GUILD YOU ARE VIEWING and the number of online players, then the list.
2) On !partycheck it should show the number of players online.
3) Change "Kinas" for "Knights".

Thanks Jetro, you are doing a great work and a perfect script!
 
This may help:

Lua:
function getGuildNameById(guild)
	local Info = db.getResult("SELECT * FROM `guilds` WHERE `id` = " .. guild .. ";")
		if (Info:getID() ~= -1) then
		local Name = Info:getDataString("name")
		Info:free()
		return Name
	end
 	return -1
end
 
1.- Another known bug is that if you try to search a guild with an space ex: Red Sky it won't work.
Code:
[18:0:44.406] [Error - TalkAction Interface]
[18:0:44.406] data/talkactions/scripts/mtibia/check_party_guild.lua:onSay
[18:0:44.406] Description:
[18:0:44.406] ...ata/talkactions/scripts/mtibia/check_party_guild.lua:7: attempt to index global 'paladins' (a nil value)
[18:0:44.406] stack traceback:
[18:0:44.406]   ...ata/talkactions/scripts/mtibia/check_party_guild.lua:7: in function 'getMembersOnline'
[18:0:44.406]   ...ata/talkactions/scripts/mtibia/check_party_guild.lua:54: in function <...ata/talkactions/scripts/mtibia/check_party_guild.lua:16>

2.- Also when you do the command and you have a lot of players online, it seems to be some disordered, example:

Guild Untouchables members list:
• Sorcerers (1): Sparco Dark [167].
• Druids (14): Wingates [179], Tribal
Kerin [177], Cantos [189], Ft Revolution
[211], Zyler [201], Nick Lee [231],
Czolowy Majster [212], Odin [237],
Mataperquin [167], Piskolita [209],
Secta Druidax [222], Im Sxy [206],
Chicarrete [205], Volxis [254].
• Paladins (4): Mohaned [221], Vazzoon
[250], Yiyiz [203], Zerodark [225].
• Knights (3): Huskar [241], Eaxk [212]
, Maka Briin [228].
• The best knights are: Huskar [241],
Eaxk [212], Maka Briin [228]

It seems to be like that and it is not nice...
Maybe it should be shown like this would be more ordered:

Guild Untouchables members list:
• Sorcerers (1):
Sparco Dark [167].
• Druids (14):
Wingates [179]
Tribal Kerin [177]
Cantos [189]
Ft Revolution [211]
Zyler [201]
Nick Lee [231]
Czolowy Majster [212]
Odin [237]
Mataperquin [167]
Piskolita [209]
Secta Druidax [222]
Im Sxy [206]
Chicarrete [205]
Volxis [254].
• Paladins (4):
Mohaned [221]
Vazzoon [250]
Yiyiz [203]
Zerodark [225].
• Knights (3):
Huskar [241]
Eaxk [212]
Maka Briin [228].
• The best knights are:
Huskar [241]
Eaxk [212], Maka Briin [228]


3.- And also when it show the "Guild Untouchables members list:" line should be like "Guild Untouchables members list (23):" showing between the parentheses the number of total players online.



Just suggestions.
 
Last edited:
updated, thanks for the suggestions and for report the bugs, aunque es frustrante que siendo tan útil nadie comente :/
 
updated, thanks for the suggestions and for report the bugs, aunque es frustrante que siendo tan útil nadie comente :/

Thanks to you, no te preocupi men, siempre la gente se demora en notar estas nuevas cosas, y mas aun si las ocupo yo, el resto las querra tener, asi que es la mejor asociacion xD
 
Bug:

1.- !guildcheck Untouchables

Code:
[22:29:54.124] [Error - TalkAction Interface]
[22:29:54.124] data/talkactions/scripts/mtibia/check_party_guild.lua:onSay
[22:29:54.124] Description:
[22:29:54.124] ...ata/talkactions/scripts/mtibia/check_party_guild.lua:9: attempt to concatenate a boolean value
[22:29:54.124] stack traceback:
[22:29:54.124]  ...ata/talkactions/scripts/mtibia/check_party_guild.lua:9: in function 'getMembersOnline'
[22:29:54.124]  ...ata/talkactions/scripts/mtibia/check_party_guild.lua:54: in function <...ata/talkactions/scripts/mtibia/check_party_guild.lua:16>

2.- En la parte de "the best knights are:" muestra los players asi: Viso [198], Eiuwiekzieka [183] y no con el listado hacia abajo.
 
Works great, 100% cool!

Lua:
Guild red sky members list (21):
• Sorcerers (1):
 Volao [203] 
• Druids (15):
 Sassi Junior [225]
Oneill [204]
Glozz [191]
Awjaifkdsaf [202]
Lykan [236]
Hardstyle [241]
Ashhito Drainer [202]
Bari [232]
Negrotrespiernas [187]
Garra Blanka [210]
Flesh [203]
Dzkiziado [177]
Juanete [226]
Arkangel [207]
Fen Yx [238]
• Paladins (2):
 Daes [218]
Territas [237]
• Knights(3):
 Dareksek [188]
Laro [202]
Patrycjusz [203]
• The best knights are:
 Dareksek [188]
Laro [202]
Patrycjusz [203]
 
I reloaded talk actions and its not working, do you have to do a reboot of the server for it to work?
 
Back
Top