Sam 56 Postado 7 de Dezembro 2025 Compartilhar Postado 7 de Dezembro 2025 EU QUERO QUE MUTA QUANDO PLAYER RELOGA ELE CONTINUA MUTADO E NAO TA DANDO SÓ DA QUANDO ELE TA ONLINE QUANDO ELE DESLOGA E LOGA SAI MUTED. local GMGroup = 6 -- grupo mínimo do GM local maxTimeMute = 60 * 24 * 360 --Tempo máximo de mute, em minutos. Sim, isso é necessário. local conditions = {} for i = 1, maxTimeMute do conditions[i] = createConditionObject(CONDITION_MUTED) setConditionParam(conditions[i], CONDITION_PARAM_TICKS, i * 60 * 1000) end function onSay(cid,words,param) local testeGroup = getPlayerGroupId(cid) if testeGroup >= GMGroup then if param ~= "" then local sep = param:explode(",") local playerMuted, timeMuted = getPlayerByName(sep[1]), tonumber(sep[2]) if not timeMuted or not conditions[timeMuted] then doPlayerSendCancel(cid, "Escolha um tempo de mute (em minutos) válido.") elseif isPlayer(playerMuted) then local GMName = getPlayerName(cid) local playerName = getPlayerName(playerMuted) if playerName == GMName then doPlayerSendTextMessage(cid,MESSAGE_STATUS_DEFAULT ,"Por que ao invés aplicar um muted em si mesmo você mesmo não cale a boca?") return 0 end local playerGroup = getPlayerGroupId(playerMuted) if playerGroup >= testeGroup then doPlayerSendTextMessage(cid,MESSAGE_STATUS_DEFAULT ,"Você não pode calar um jogador que tenha um cargo maior ou igual ao seu.") return 0 end doAddCondition(playerMuted, conditions[timeMuted]) setPlayerStorageValue(cid, 91828, os.time() + timeMuted * 60) doPlayerSendTextMessage(cid,MESSAGE_STATUS_DEFAULT ,"Você aplicou um muted de "..timeMuted.." minuto(s) no jogador "..playerName..".") doPlayerSendTextMessage(playerMuted,MESSAGE_STATUS_DEFAULT,"Você foi mutado por "..timeMuted.." minuto(s) pelo "..GMName..".") else doPlayerSendTextMessage(cid,MESSAGE_STATUS_DEFAULT ,"O nome "..param.." está escrito errado ou este está offline.") end end end return true end Link para o comentário https://tibiadevs.com/forums/topic/1344-tfs-036-860-mute-system/ Compartilhar em outros sites Mais opções de compartilhamento...
blxr 9 Postado 27 de Dezembro 2025 Compartilhar Postado 27 de Dezembro 2025 Em 07/12/2025 em 15:50, Sam disse: EU QUERO QUE MUTA QUANDO PLAYER RELOGA ELE CONTINUA MUTADO E NAO TA DANDO SÓ DA QUANDO ELE TA ONLINE QUANDO ELE DESLOGA E LOGA SAI MUTED. local GMGroup = 6 -- grupo mínimo do GM local maxTimeMute = 60 * 24 * 360 --Tempo máximo de mute, em minutos. Sim, isso é necessário. local conditions = {} for i = 1, maxTimeMute do conditions[i] = createConditionObject(CONDITION_MUTED) setConditionParam(conditions[i], CONDITION_PARAM_TICKS, i * 60 * 1000) end function onSay(cid,words,param) local testeGroup = getPlayerGroupId(cid) if testeGroup >= GMGroup then if param ~= "" then local sep = param:explode(",") local playerMuted, timeMuted = getPlayerByName(sep[1]), tonumber(sep[2]) if not timeMuted or not conditions[timeMuted] then doPlayerSendCancel(cid, "Escolha um tempo de mute (em minutos) válido.") elseif isPlayer(playerMuted) then local GMName = getPlayerName(cid) local playerName = getPlayerName(playerMuted) if playerName == GMName then doPlayerSendTextMessage(cid,MESSAGE_STATUS_DEFAULT ,"Por que ao invés aplicar um muted em si mesmo você mesmo não cale a boca?") return 0 end local playerGroup = getPlayerGroupId(playerMuted) if playerGroup >= testeGroup then doPlayerSendTextMessage(cid,MESSAGE_STATUS_DEFAULT ,"Você não pode calar um jogador que tenha um cargo maior ou igual ao seu.") return 0 end doAddCondition(playerMuted, conditions[timeMuted]) setPlayerStorageValue(cid, 91828, os.time() + timeMuted * 60) doPlayerSendTextMessage(cid,MESSAGE_STATUS_DEFAULT ,"Você aplicou um muted de "..timeMuted.." minuto(s) no jogador "..playerName..".") doPlayerSendTextMessage(playerMuted,MESSAGE_STATUS_DEFAULT,"Você foi mutado por "..timeMuted.." minuto(s) pelo "..GMName..".") else doPlayerSendTextMessage(cid,MESSAGE_STATUS_DEFAULT ,"O nome "..param.." está escrito errado ou este está offline.") end end end return true end Você salva o storage no GM, não no player mutado setPlayerStorageValue(cid, 91828, ...) deveria ser no playerMuted Não existe onLogin reaplicando o mute O mute não é reaplicado com tempo restante, só enquanto online O código corrigido ficaria assim: local GMGroup = 6 local maxTimeMute = 60 * 24 * 360 -- até 360 dias local STORAGE_MUTE = 91828 local conditions = {} for i = 1, maxTimeMute do conditions[i] = createConditionObject(CONDITION_MUTED) setConditionParam(conditions[i], CONDITION_PARAM_TICKS, i * 60 * 1000) end function onSay(cid, words, param) if getPlayerGroupId(cid) < GMGroup then return true end if param == "" then doPlayerSendCancel(cid, "Use: !mute nome, tempo(em minutos)") return true end local sep = param:explode(",") local playerMuted = getPlayerByName(sep[1]) local timeMuted = tonumber(sep[2]) if not timeMuted or not conditions[timeMuted] then doPlayerSendCancel(cid, "Escolha um tempo de mute válido.") return true end if not isPlayer(playerMuted) then doPlayerSendCancel(cid, "O jogador precisa estar online para receber o mute.") return true end if getPlayerGroupId(playerMuted) >= getPlayerGroupId(cid) then doPlayerSendCancel(cid, "Você não pode mutar alguém com cargo igual ou maior.") return true end local endTime = os.time() + (timeMuted * 60) doAddCondition(playerMuted, conditions[timeMuted]) setPlayerStorageValue(playerMuted, STORAGE_MUTE, endTime) doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Você aplicou mute de "..timeMuted.." minuto(s) em "..getPlayerName(playerMuted)..".") doPlayerSendTextMessage(playerMuted, MESSAGE_STATUS_DEFAULT, "Você foi mutado por "..timeMuted.." minuto(s).") return true end E no login.lua ou creaturescripts/onLogin teria que guardar essa info do storage, mais ou menos assim: local STORAGE_MUTE = 91828 function onLogin(cid) local muteTime = getPlayerStorageValue(cid, STORAGE_MUTE) if muteTime ~= -1 and muteTime > os.time() then local remaining = math.ceil((muteTime - os.time()) / 60) local condition = createConditionObject(CONDITION_MUTED) setConditionParam(condition, CONDITION_PARAM_TICKS, remaining * 60 * 1000) doAddCondition(cid, condition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Você ainda está mutado por "..remaining.." minuto(s).") elseif muteTime ~= -1 then setPlayerStorageValue(cid, STORAGE_MUTE, -1) end return true end E teria que registrar o evento em creaturescripts.xml <event type="login" name="MuteLogin" script="login.lua"/> Link para o comentário https://tibiadevs.com/forums/topic/1344-tfs-036-860-mute-system/#findComment-7093 Compartilhar em outros sites Mais opções de compartilhamento...
Posts Recomendados
Crie uma conta ou entre para comentar
Você precisar ser um membro para fazer um comentário
Criar uma conta
Crie uma nova conta em nossa comunidade. É fácil!
Crie uma nova contaEntrar
Já tem uma conta? Faça o login.
Entrar Agora