Ir para conteúdo

Featured Replies

Postado

A pedido desse tópico fiz a talkaction : http://www.tibiaking.com/forum/topic/55478-pedido-comando-de-mute-para-tutor/

 


data/talkactions/script/mute.lua

 


TFS 1.1 :

function onSay(player, words, param)

	local storage = 456112

	if words == "/mute" then
		local mute = param:split(",")

		if mute[1] == nil or mute[1] == " " then
			player:sendCancelMessage("Invalid player specified.")
			return false
		end

		if mute[2] == nil or mute[2] == " " then
			player:sendCancelMessage("Invalid time specified.")
			return false
		end

		local target = Player(mute[1])
		local time = tonumber(mute[2])
		local condition = Condition(CONDITION_MUTED)
		condition:setParameter(CONDITION_PARAM_TICKS, time*60*1000)

		if player:getAccountType() < ACCOUNT_TYPE_TUTOR then
			return false
		end

		if target == nil then
			player:sendCancelMessage("A player with that name is not online.")
			return false
		end

		if target:getAccountType() >= ACCOUNT_TYPE_TUTOR then
			player:sendCancelMessage("Only player can be mutated")
			return false
		end

		target:addCondition(condition)
		target:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been muted by " .. player:getName() .. " , to "..time.. " minutes.")
		player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You muted " .. target:getName() .." to "..time.." minutes.")
		target:setStorageValue(storage, 1)
		return false
	end

	if words == "/unmute" then

		local remove = Player(param)

		if player:getAccountType() < ACCOUNT_TYPE_TUTOR then
			return false
		end

		if remove == nil then
			player:sendCancelMessage("A player with that name is not online.")
			return false
		end

		if remove:getAccountType() >= ACCOUNT_TYPE_TUTOR then
			return false
		end

		if remove:getStorageValue(storage) == 1 then
			remove:removeCondition(CONDITION_MUTED)
			remove:setStorageValue(storage, -1)
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have unmute" .. remove:getName() ..".")
			remove:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been unmute by " .. player:getName() ..".")
		else
			player:sendCancelMessage("A player " .. remove:getName() .. "is not mutated")
		end
	end

	return false
end


TFS 1.0 :

 

function onSay(cid, words, param)

	local player = Player(cid)
	local storage = 456112

	if words == "/mute" then
		local mute = param:split(",")

		if mute[1] == nil or mute[1] == " " then
			player:sendCancelMessage("Invalid player specified.")
			return false
		end

		if mute[2] == nil or mute[2] == " " then
			player:sendCancelMessage("Invalid time specified.")
			return false
		end

		local target = Player(mute[1])
		local time = tonumber(mute[2])
		local condition = Condition(CONDITION_MUTED)
		condition:setParameter(CONDITION_PARAM_TICKS, time*60*1000)

		if player:getAccountType() < ACCOUNT_TYPE_TUTOR then
			return false
		end

		if target == nil then
			player:sendCancelMessage("A player with that name is not online.")
			return false
		end

		if target:getAccountType() >= ACCOUNT_TYPE_TUTOR then
			player:sendCancelMessage("Only player can be mutated")
			return false
		end

		target:addCondition(condition)
		target:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been muted by " .. player:getName() .. " , to "..time.. " minutes.")
		player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You muted " .. target:getName() .." to "..time.." minutes.")
		target:setStorageValue(storage, 1)
		return false
	end

	if words == "/unmute" then

		local remove = Player(param)

		if player:getAccountType() < ACCOUNT_TYPE_TUTOR then
			return false
		end

		if remove == nil then
			player:sendCancelMessage("A player with that name is not online.")
			return false
		end

		if remove:getAccountType() >= ACCOUNT_TYPE_TUTOR then
			return false
		end

		if remove:getStorageValue(storage) == 1 then
			remove:removeCondition(CONDITION_MUTED)
			remove:setStorageValue(storage, -1)
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have unmute" .. remove:getName() ..".")
			remove:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been unmute by " .. player:getName() ..".")
		else
			player:sendCancelMessage("A player " .. remove:getName() .. "is not mutated")
		end
	end

	return false
end


 

em talkactions.XML, adicione :

	<talkaction words="/mute" separator=" " script="mute.lua" />
	<talkaction words="/unmute" separator=" " script="mute.lua" />


Modo de usar :

 

/mute Linus, 1
/unmute Linus

Editado por luanluciano93 (veja o histórico de edições)

I must not fear. Fear is the mind killer.

  • Respostas 13
  • Visualizações 1.3k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

Postado

Tópico aprovado e movido para a seção correta, um ponto de reputação foi dado  :accept:

                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

Postado

To Gostando de ver alguem Focando em Scripts 1.x no TK!! Bom Script Irei Testar e Se Funcionar Ganhara um ponto de Reputação! E eu usarei no meu OT se Funfa!

 

Edited!

 

Funcionou! Ganhou Ponto de Reputação e eu usarei no meu OT! Vlw aew + uma vez

Editado por Zet0N0Murmurou (veja o histórico de edições)

wq3bBzt.png
Pokémon Dust Evolution
 
É aonde começa sua nova aventura!! 

 

Facebook

 
Verifique Atualizações

 

Postado

TFS 1 deu um probleminha...

 

A player with that name is not online.

Apenas isso!!

Tudo certinho, mas da isso!! E /unmute nao mudou nada.

Obs: Uso TFS 1.0

Postado

duas perguntas basicas:

 

1 eu nao tenho ideia que tfs é poketibia, esse script funfaria?

 

2 ´só da muted no help ou em qualquer chat global?

Minhas Gambiarras :rock:

 

 

[PDA] Pokedex Mostrando o Catch

 

http://www.tibiaking.com/forum/topic/54998-pda-arrumando-a-dex/?view=findpost&p=323041

 

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.7k

Informação Importante

Confirmação de Termo