[Talkaction] !partycheck E !guildcheck

SkyDangerous
em Actions e Talkactions

SkyDangerous

Deus Kalec
avatar
Lorde
Lorde

INFOS

Grupo: LordeRegistrado: 17/01/09Posts: 2098Char no Tibia: Adra Sata

Funções:

 

Comando: !partycheck

 

Ele mostra no channel quanto de cada vocação estão na party e mostra os três Knights mais forte(caso queria utilizar-lo para blocar)

 

Comando: !guildcheck

 

Ele mostra no channel do servidor quantos jogadores da sua guild estão on-line mostrando os nomes e também mostra os três knights mais forte.

 

Testado em: TFS 0.3.6

 

Crie um arquivo qualquer com nome de partyguildcheck.lua e adicione o comando abaixo

 

function getOnlineGuildMembers(cid)
local t = {}
local p = getPlayersOnline()
local g = getPlayerGuildId(cid)
for _, ps in ipairs(p) do
	local gs = getPlayerGuildId(ps)
	if(g == gs and gs > 0 and g > 0) then
		table.insert(t, ps)
	end
end
return t
end
function getGuildMembersByVoc(cid, voc)
local h = getOnlineGuildMembers(cid)
for _, gid in ipairs(h) do
	local vg = getPlayerVocation(gid)
	if(vg == voc) then
		local gv = {}
		table.insert(gv, gid)
		return gv
	end
end
return false
end
function getPartyMembersByVoc(cid, voc)
local h = getPartyMembers(cid)
local yv = {}
for _, yid in ipairs(h) do
	local vx = getPlayerVocation(yid)
	if(vx == voc) then
		table.insert(yv, yid)
	end
end
return yv
end
local text = ""
local count = 0
local vocCount = {}
local regv = {}
local highlevel = 125
function onSay(cid, words, param, channel)
if(words == "!partycheck") then
	local pmem = getPartyMembers(getPartyLeader(cid))
	text = "-- Party Check --\n"
	if(type(pmem) == "table") then
		if(#pmem <= 1) then
			text = text .. "You are alone!!!"
			return doPlayerSendTextMessage(cid, 22, text)
		elseif(#pmem > 1) then
			for i = 0, 4 do
				local k = getPartyMembersByVoc(cid, i)
				local vocvar = getVocationInfo(i).name
				text = text .. " " .. #k .. " " .. vocvar .. "\n"
			end
			local k2 = getPartyMembersByVoc(cid, 4)
			text = text .. "\n  --High knights: "
			for _, kid in ipairs(k2) do
				local klvl = getPlayerLevel(kid)
				if(klvl >= highlevel) then
					count = count + 1
					if(count <= 3) then
						text = text .. getPlayerName(kid) .. "[".. klvl .."]" .. (count < 3 and ", " or ".")
					end
				end
			end
			text = text .. "."
		end																			  
	else
		text = "-- You are not in any party. -- "
	end
	elseif(words == "!guildcheck") then
	local gmem = getOnlineGuildMembers(cid)
	text = "-- Guild Check --\n"
	if(#gmem ~= 0) then
		local noneCount = 0
		local g = {name = getPlayerGuildName(cid)}
		text = "[".. g.name .."] There are ".. #gmem .." players playing. "
		for _, gid in ipairs(gmem) do
			noneCount = noneCount + 1
			text = text .. getPlayerName(gid) .. (noneCount == #gmem and "." or ", ")
		end
		local k2 = getPartyMembersByVoc(cid, 4)
		text = text .. "\n  --High knights: "
		for _, kid in ipairs(k2) do
			local klvl = getPlayerLevel(kid)
			if(klvl >= highlevel) then
				count = count + 1
				if(count <= 3) then
					text = text .. getPlayerName(kid) .. "[".. klvl .."]" .. (count < 3 and ", " or ".")
				end
			end
		end
		text = text .. "."
	else
		text = "You are not in a guild."
	end
end
return doPlayerSendTextMessage(cid, 22, text)
end

 

Obs: Edite apenas onde estiver escrito.

 

 

 

agora em talkaction.xml adicione

<talkaction words="!guildcheck;!partycheck" event="script" value="partyguildcheck.lua"/>

 

Imagem:

sinttulozqq.png

 

 

 



Crédito


KylerXX

Me segui lá (:

 

b906.png

http://ageofwar.servegame.com/

IP: ageofwar.servegame.com

TIBIA: 10.78

GLOBAL PERFECT CUSTOM

139

Leonardo
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 08/12/09Posts: 76Char no Tibia: Zoralurk

Comandos muito utéis, irei por no meu server.

Obrigado por trazer conteúdo ao Xtibia.

Só não do Rep+ agora pq já atingi o limite de hoje.

Piabeta Kun

Ex-Coordenador de Websites
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 23/12/08Posts: 2403Gênero: MasculinoChar no Tibia: Gordo Warlike

muito bom script sky!

 

não é atoa q sou seu fan shaushau!

Daijobu!

 

Fir3element

avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 16/06/08Posts: 998Gênero: Masculino

o.O o cara fez isso tudo sem usar uma query, que cara foda.

 

testando identação kk

 

 

function getOnlineGuildMembers(cid)
local t = {}
local p = getPlayersOnline()
local g = getPlayerGuildId(cid)
for _, ps in ipairs(p) do
	local gs = getPlayerGuildId(ps)
	if(g == gs and gs > 0 and g > 0) then
		table.insert(t, ps)
	end
end
return t
end
function getGuildMembersByVoc(cid, voc)
local h = getOnlineGuildMembers(cid)
for _, gid in ipairs(h) do
	local vg = getPlayerVocation(gid)
	if(vg == voc) then
		local gv = {}
		table.insert(gv, gid)
		return gv
	end
end
return false
end
function getPartyMembersByVoc(cid, voc)
local h = getPartyMembers(cid)
local yv = {}
for _, yid in ipairs(h) do
	local vx = getPlayerVocation(yid)
	if(vx == voc) then
		table.insert(yv, yid)
	end
end
return yv
end
local text = ""
local count = 0
local vocCount = {}
local regv = {}
local highlevel = 125
function onSay(cid, words, param, channel)
if(words == "!partycheck") then
	local pmem = getPartyMembers(getPartyLeader(cid))
	text = "-- Party Check --\n"
	if(type(pmem) == "table") then
		if(#pmem <= 1) then
			text = text .. "You are alone!!!"
			return doPlayerSendTextMessage(cid, 22, text)
		elseif(#pmem > 1) then
			for i = 0, 4 do
				local k = getPartyMembersByVoc(cid, i)
				local vocvar = getVocationInfo(i).name
				text = text .. " " .. #k .. " " .. vocvar .. "\n"
			end
			local k2 = getPartyMembersByVoc(cid, 4)
			text = text .. "\n  --High knights: "
			for _, kid in ipairs(k2) do
				local klvl = getPlayerLevel(kid)
				if(klvl >= highlevel) then
					count = count + 1
					if(count <= 3) then
						text = text .. getPlayerName(kid) .. "[".. klvl .."]" .. (count < 3 and ", " or ".")
					end
				end
			end
			text = text .. "."
		end																			  
	else
		text = "-- You are not in any party. -- "
	end
	elseif(words == "!guildcheck") then
	local gmem = getOnlineGuildMembers(cid)
	text = "-- Guild Check --\n"
	if(#gmem ~= 0) then
		local noneCount = 0
		local g = {name = getPlayerGuildName(cid)}
		text = "[".. g.name .."] There are ".. #gmem .." players playing. "
		for _, gid in ipairs(gmem) do
			noneCount = noneCount + 1
			text = text .. getPlayerName(gid) .. (noneCount == #gmem and "." or ", ")
		end
		local k2 = getPartyMembersByVoc(cid, 4)
		text = text .. "\n  --High knights: "
		for _, kid in ipairs(k2) do
			local klvl = getPlayerLevel(kid)
			if(klvl >= highlevel) then
				count = count + 1
				if(count <= 3) then
					text = text .. getPlayerName(kid) .. "[".. klvl .."]" .. (count < 3 and ", " or ".")
				end
			end
		end
		text = text .. "."
	else
		text = "You are not in a guild."
	end
end
return doPlayerSendTextMessage(cid, 22, text)
end

 

 

SkyDangerous

Deus Kalec
avatar
Lorde
Lorde

INFOS

Grupo: LordeRegistrado: 17/01/09Posts: 2098Char no Tibia: Adra Sata

Nao e necessario query.

Pois o script pega os players online e informacoes do servidor e nao tem necessidade utiliza extracoes de informacoes pelo banco de dados(sql)

Mas acho que daria pra fazer com query :)..

 

Sei la kkk

 

Att..

Me segui lá (:

 

b906.png

http://ageofwar.servegame.com/

IP: ageofwar.servegame.com

TIBIA: 10.78

GLOBAL PERFECT CUSTOM

Administrador

xTibia 2017
avatar
Administrador
Administrador

INFOS

Grupo: AdministradorRegistrado: 09/07/05Posts: 5780Gênero: Outro

Interessante Sky,

Pelo visto a galera gostou mesmo :D

DICA

Utilize botão @UP, no início de seu tópico, para atualizar o destaque de seu tópico em "Tópicos Recentes" na index, fará com que mais pessoas o vejam.

 

 

HisashiitYamaguti

O Cortiço - Aluísio Azevedo.
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 17/07/11Posts: 705

Eu não achei necessariamente útil o da guild para os ot servers com xampp, pois esse comando já existe parecido, porém fica no site.

Porém o da party, eu jamais tinha visto esse dai, para mim não seria de grande utilidade, pois todos que ficaram de party comigo, são do skype, mas tem gente ai que deve precisar, eu acho. E também, quando o player morre, ele perde o party, seria legal se você fize-se um comando, desenvolvendo as sources (projeto em grupo), que faria parecido com o comando party, mas seria para pkalizar. Ai quando um player do comando pkalizador morre-se, apareceria no /b:

(Playername) Da Guild (Namedaguild) Foi morto pelos (Playername) (playername) da guild (guildname).

Esse comando seria muito útil, pois os caras que pkaliza, ás vezes não tem guild e pode fazer um grupo de matar, mas não uma guild, pois pkalizar só tem fins lucrativos, honra, fama e status :).

 

Mas o comando da guild seria bom para ot servers sem o xampp, mas inúteis para os com xampp.

Já o da party, achei legalzinho, para os dois ot servers.

hisashi.png

 

72asdf

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 28/12/11Posts: 32

Credits by Xafterin of otserv.es...

Faisher

avatar
Banidos
Banidos

INFOS

Grupo: BanidosRegistrado: 20/11/10Posts: 35Char no Tibia: Peei

@up:

 

KylerXX and Xafterin -> same person. (Faisher). Haha :D

Subhe

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 01/11/11Posts: 124Char no Tibia: Subhe

aqui funcionou só o !partycheck, o !guildcheck nao pegou não

tem como alguem me ajudar ae ?

 

meu otserv é Alissow 8.60

 

desde já agradeço :*