Ir para conteúdo

Featured Replies

Postado

function string.explode(str, sep, limit)
    if(type(sep) ~= 'string' or isInArray({tostring(str):len(), sep:len()}, 0)) then
        return {}
    end

    local i, pos, tmp, t = 0, 1, "", {}
    for s, e in function() return string.find(str, sep, pos) end do
        tmp = str:sub(pos, s - 1):trim()
        table.insert(t, tmp)
        pos = e + 1

        i = i + 1
        if(limit ~= nil and i == limit) then
            break
        end
    end

    tmp = str:sub(pos):trim()
    table.insert(t, tmp)
    return t
end

function onSay(cid, words, param)
    local player = Player(cid)
    local m = string.explode(param, ",")
    local target = Player(m[1])
    local time = tonumber(m[2])

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

    if time == nil then
        player:sendCancelMessage("Invalid param specified.")
        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_NORMAL then
        player:sendCancelMessage("You can only mutate a normal player.")
        return false
    end

    if time == 0 or time >= 360 then
        player:sendCancelMessage("you can only mute for a maximum of 360 minutes")
        return false
    end

    local condition = Condition(CONDITION_MUTED)
    condition:setParameter(CONDITION_PARAM_TICKS, time*60*1000)

    target:doAddCondition(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.")
    return true
end
  • Respostas 35
  • Visualizações 6.8k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • function onSay(cid, words, param) local player = Player(cid) local m = string.explode(param, ",") local target = Player(m[1]) local time = tonumber(m[2]) if player:getAccountType() < ACCOUNT

  • Em data/talkactions crie um arquivo com nome Muteplayer.lua e cole isso dentro :   Adicione essa tag em talkactions.xml : Em data/creatureevents crie um arquivo com nome Mute_check e cole isso de

  • mute.lua : function onSay(cid, words, param) local CHANNEL_HELP = 7 local player = Player(cid) local storage = 456112 if words == "/mute" then local mute = param:split(",") if mute[1] ==

Postado
  • Solução

mute.lua :

function onSay(cid, words, param)

	local CHANNEL_HELP = 7
	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_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT)
		condition:setParameter(CONDITION_PARAM_SUBID, CHANNEL_HELP)
		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)
		sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " has been muted by " .. player:getName() .. " for using Help Channel inappropriately.")
		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_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP)
			sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, remove:getName() .. " has been unmuted by " .. player:getName() .. ".")
			remove:setStorageValue(storage, -1)
		else
			player:sendCancelMessage("A player " .. remove:getName() .. "is not mutated")
		end
	end

	return false
end

oZ_4WzviL.png

As Pessoas vivem apegadas aquilo que traduzem como correto e verdadeiro,assim elas definem a realidade.

mas oque significa o correto e o verdadeiro?

 

 

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