Ir para conteúdo

Featured Replies

Postado
Em 11/09/2018 em 23:19, Lyu disse:

Aguarda aí que eu fiz um tem algum tempo, vou procurar!

 

*Edit,

Achei, segue abaixo o mesmo:

 

talkactions.xml


<talkaction default="yes" filter="quotation" logged="no" event="script" value="playersay.lua"/>
<talkaction log="yes" group="4" access="3" words="/helpmute" event="script" value="helpmute.lua"/>

 

playersay.lua


function onSay(cid, words, param, channel)
	local time = getPlayerStorageValue(cid, 455010)
	if channel == CHANNEL_HELP and time > os.time() then
		return doPlayerSendCancel(cid, 'You are muted for ' .. (time - os.time()).. ' second' .. ((time - os.time()) > 1 and 's' or '').. ' in this channel.')
	end
	
end

 

helpmute.lua


function onSay(cid, words, param, channel)
	if param == '' then
		return doPlayerSendCancel(cid, 'Please, type mute or unmute.')
	end
	
	local tmp = string.explode(param, ',')
	if isInArray({'mute', 'unmute'}, tmp[1]:lower()) then

		local default = 600
		if isCreature(getCreatureByName(tmp[2])) then
			setPlayerStorageValue(getCreatureByName(tmp[2]), 455010, tmp[1]:lower() == 'mute' and os.time() + (tmp[3] ~= nil and tonumber(tmp[3]) or default) or -1)
			doPlayerSendCancel(cid, 'Player ' .. tmp[2] .. ' ' .. (tmp[1]:lower() == 'mute' and 'muted' or 'unmuted') .. '.')
		else
			
			doPlayerSendCancel(cid, 'Player not exists or is off-line.')
		end
	end
	
	return true
end

 

 

Funcionando perfeitamente em TFS 0.4

 

Fiz uma adaptação no código para enviar uma mensagem no channel Counselor avisando que o senior tutor X mutou ou desmutou o player X.

 

spacer.png

 

Tinha visto isso no server do MegaTibia quando eu era tutor.

 

helpmute.lua:

 

function onSay(cid, words, param, channel)
	if param == '' then
		return doPlayerSendCancel(cid, 'Please, type mute or unmute.')
	end
	
	local tmp = string.explode(param, ',')
	if isInArray({'mute', 'unmute'}, tmp[1]:lower()) then

		local default = 600
		if isCreature(getCreatureByName(tmp[2])) then
			setPlayerStorageValue(getCreatureByName(tmp[2]), 455010, tmp[1]:lower() == 'mute' and os.time() + (tmp[3] ~= nil and tonumber(tmp[3]) or default) or -1)
			doPlayerSendCancel(cid, 'Player ' .. tmp[2] .. ' ' .. (tmp[1]:lower() == 'mute' and 'muted' or 'unmuted') .. '.')

				for _, pid in ipairs(getPlayersOnline()) do
					doPlayerSendChannelMessage(pid, '', "".. getCreatureName(cid) .. " has ".. (tmp[1]:lower() == 'mute' and 'muted' or 'unmuted') .." the player " .. tmp[2] .. " in channel Help", TALKTYPE_CHANNEL_W, 4)
				end
		else
			
			doPlayerSendCancel(cid, 'Player not exists or is off-line.')
		end
	end
    
	return true
end

 

 

  • Respostas 15
  • Visualizações 2.1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Aguarda aí que eu fiz um tem algum tempo, vou procurar!   *Edit, Achei, segue abaixo o mesmo:   talkactions.xml <talkaction default="yes" filter="quotation" logged="no"

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo