Ir para conteúdo

Featured Replies

Postado

Screenshot


9hkzE7c4m.png
 

Descrição


Lembra quando apenas o leader e vice-leader da guild poderiam usar o comando !go e logo mudava o outfit de todos? Pois então.
 

Instalando


Crie um arquivo chamado guild_outfit.lua na pasta talkactions e coloque: 
function string.diff(self)
	local format = {
		{'day', self / 60 / 60 / 24},
		{'hour', self / 60 / 60 % 24},
		{'minute', self / 60 % 60},
		{'second', self % 60}
	}

	local out = {}
	for k, t in ipairs(format) do
		local v = math.floor(t[2])
		if(v > 0) then
			table.insert(out, (k < #format and (#out > 0 and ', ' or '') or ' and ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
		end
	end

	local ret = table.concat(out)
	if ret:len() < 16 and ret:find('second') then
		local a, b = ret:find(' and ')
		ret = ret:sub(b+1)
	end
	
	return ret
end

local config = {
	exhaustion = 299551, -- exhaust storage
	duration = 5 -- CONTADO EM SEGUNDOS, POR EXEMPLO 5*60 PARA 5 MINUTOS.
}

function onSay(player, words, param, channel, creature)

	local playerGuild = player:getGuild()
	local creature = player

	if (os.time() - player:getStorageValue(config.exhaustion)) < config.duration then
		player:sendTextMessage(MESSAGE_INFO_DESCR,"You have to wait ' .. string.diff(player:getStorageValue(config.exhaustion)-os.time()) .. ' before using this command again.")
		return false
	end

	if(not playerGuild or playerGuild:getId() == 0) then
		player:sendTextMessage(MESSAGE_INFO_DESCR,"Sorry, you're not in a guild.")
		return false
	end

	if player:getGuildLevel() < 2 then -- 3 = Leader, 2 = Vice-Leader, 1 = Regular Member
		player:sendTextMessage(MESSAGE_INFO_DESCR,"You have to be Leader or Vice-Leader of your guild to change outfits!")
		return false
	end

	local outfit = creature:getOutfit()
	local count = 0
	local message = "*Guild* Your outfit has been changed by leader. (" ..player:getName() .. ")"

	for _, members in ipairs(Game.getPlayers()) do
		if(members:getGuild() == playerGuild and player ~= members) then
			local newOutfit = outfit
			if(not members:hasOutfit(outfit.lookType, outfit.lookAddons)) then
				local tmpOutfit = members:getOutfit()
				newOutfit.lookAddons = 0 --tmpOutfit.lookAddons
				if(not members:hasOutfit(outfit.lookType, 0)) then
					newOutfit.lookType = tmpOutfit.lookType
				end
			end

			members:getPosition():sendMagicEffect(66)
			members:setOutfit(newOutfit)
			members:sendTextMessage(MESSAGE_INFO_DESCR, message)
			count = count + 1
		end
	end

	player:sendTextMessage(MESSAGE_INFO_DESCR,"Guild members outfit has been changed. (Total: " .. count .. ")")
	player:setStorageValue(config.exhaustion, os.time() + config.duration)
	
	return false
end 

talkactions.xml

<talkaction words="!go" event="script" value="guild_outfit.lua"/>

Créditos

  • Slawkens, narko.
  • 3 weeks later...
  • 2 months later...
Postado

Bem legal, haha

Só arruma a tag q ta errada

<talkaction words="!cor" script="guild_outfit.lua"/>
tem q ser assim :)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo