Furabio 258 Postado Maio 13, 2015 Share Postado Maio 13, 2015 data/talkactions/script/mute.lua TFS 1.1 : 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 em talkactions.XML, adicione : <talkaction words="/mute" separator=" " script="mute.lua" /> <talkaction words="/unmute" separator=" " script="mute.lua" /> Modo de usar : /mute ScreaM, 1 /unmute ScreaM Link para o comentário https://xtibia.com/forum/topic/233883-tfs-1x-mute-unmute/ Compartilhar em outros sites More sharing options...
Bruno 536 Postado Maio 13, 2015 Share Postado Maio 13, 2015 Muito bom Só uma dica, no comando /unmute coloque um verificador para dar erro caso o "param" esteja nulo. Link para o comentário https://xtibia.com/forum/topic/233883-tfs-1x-mute-unmute/#findComment-1651273 Compartilhar em outros sites More sharing options...
Administrador Administrador 1437 Postado Maio 17, 2015 Administrador Share Postado Maio 17, 2015 Não seria bacana sair na mensagem de aviso o tempo do mute? Ótimo sistema, eu usava muito no globalwar. Link para o comentário https://xtibia.com/forum/topic/233883-tfs-1x-mute-unmute/#findComment-1651754 Compartilhar em outros sites More sharing options...
Furabio 258 Postado Maio 17, 2015 Autor Share Postado Maio 17, 2015 Não seria bacana sair na mensagem de aviso o tempo do mute? Ótimo sistema, eu usava muito no globalwar. Verdade, nem pensei nisso, dps dou uma editada e adiciono Link para o comentário https://xtibia.com/forum/topic/233883-tfs-1x-mute-unmute/#findComment-1651762 Compartilhar em outros sites More sharing options...
Animal Pak 369 Postado Maio 18, 2015 Share Postado Maio 18, 2015 Tem como fazer para o tfs 0.4? já tentei vários scripts do mute e nenhum funcionou no tfs 0.4 Link para o comentário https://xtibia.com/forum/topic/233883-tfs-1x-mute-unmute/#findComment-1651828 Compartilhar em outros sites More sharing options...
Posts Recomendados