Postado Abril 16, 2015 10 anos 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
Postado Abril 16, 2015 10 anos Autor Está dando o mesmo erro que o do Linus deu. Tem uma print na página 2, ultimo comentário.
Postado Abril 16, 2015 10 anos arthur \/ : http://www.tibiaking.com/forum/topic/55518-tfs-1x-mute-unmute/ As Pessoas vivem apegadas aquilo que traduzem como correto e verdadeiro,assim elas definem a realidade. mas oque significa o correto e o verdadeiro?
Postado Abril 17, 2015 10 anos Autor Linus, funcionou, só que eu queria que ele só muta-se o player no help e esse ,muta o player pra falar qualquer coisa em qualquer channel.
Postado Abril 17, 2015 10 anos 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 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.