• 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] script which shows whos online from guild where is cid

destro84

New Member
Joined
Apr 14, 2010
Messages
43
Reaction score
0
Hey, I need script which works like command !online (total players online from guild and level near nick in [] ) but shows only players from guild where is player which made this command

I will be grateful if someone could help :)
 
Code:
local config = {
	showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}

function onSay(cid, words, param, channel)
	local gid = getPlayerGuildId(cid)
	if(not gid or gid < 1) then
		doPlayerSendCancel(cid, "You are not in a guild.")
		return true
	end
	local allPlayers = getPlayersOnline()
	local players = {}
	for _, pid in ipairs(allPlayers) do
		if(getPlayerGuildId(pid) == gid) then
			table.insert(players, pid)
		end
	end
	local strings = {""}

	local i, position = 1, 1
	local added = false
	for _, pid in ipairs(players) do
		if(added) then
			if(i > (position * 7)) then
				strings[position] = strindgs[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) .. "]"
			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
 
Thanks, repped.
But how can make that this command can be used only in guid channel and shows result in guild channel in white color? :)
 
Change this:
Code:
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) online:")
to this:
Code:
doPlayerSendChannelMessage(cid, getPlayerGuildName(cid), (i - 1) .. " players(s) online:", TALKTYPE_CHANNEL_W, CHANNEL_GUILD)
Then the message will be sent in your guild channel, in white
 
Back
Top