Sendo que o jogador e o tempo ja foram informados!
Teste agora:
function onSay(cid, words, param)
local CHANNEL_HELP = 7
local storage = 456112
if words == "/mute" then
local mute = param:split(",")
local target = getPlayerByName(mute[1])
local time = tonumber(mute[2])
if target == false then
doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
return false
end
if time == nil then
doPlayerSendCancel(cid, "Informe o tempo em minutos.")
return false
end
local condition = createConditionObject(CONDITION_MUTED)
setConditionParam(condition, CONDITION_PARAM_SUBID, CHANNEL_HELP)
setConditionParam(condition, CONDITION_PARAM_TICKS, time * 60 * 1000)
doAddCondition(target, condition)
doPlayerSendTextMessage(target, MESSAGE_INFO_DESCR, "Você foi mutado por " .. time .. " minutos.")
setPlayerStorageValue(target, storage, 1)
return false
elseif words == "/unmute" then
local remove = getPlayerByName(param)
if remove == false then
doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
return false
end
if getPlayerStorageValue(remove, storage) == 1 then
doRemoveCondition(remove, CONDITION_MUTED, CONDITIONID_DEFAULT, CHANNEL_HELP)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você desmutou o jogador " .. getCreatureName(remove) .. ".")
setPlayerStorageValue(target, storage, -1)
else
doPlayerSendCancel(cid, "O jogador " .. getCreatureName(remove) .. " nao esta mutado.")
end
end
return false
end




info
Grupo: Lorde
Registrado: 22/07/12
Posts: 2.2k
Reputação: +453
Char no Tibia: Kissy
Em channels.xml, especifique um número para conditionId, como conditionId = "4" e use a talkaction assim
function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, 21, "explaining the talkaction") return true end local t = string.explode(param, ",") player = getPlayerByName(t[1]) local condition = createConditionObject(CONDITION_MUTED) if(not t[2] or t[2] == '') then doPlayerSendTextMessage(cid, 21, "explaining the talkaction") end if t[2] then time = tonumber(t[2]*1000) -- 10*1000 is 10 seconds. if(isPlayer(player) == TRUE and getPlayerGroupId(cid) > getPlayerGroupId(player) and getPlayerFlagValue(player, PLAYERFLAG_CANNOTBEMUTED) == false) then setConditionParam(condition, CONDITION_PARAM_SUBID, 4) doAddCondition(player, condition) doPlayerSendTextMessage(player, MESSAGE_STATUS_WARNING, "You have been muted by " .. getPlayerName(cid) .. " for " .. t[2] .. " seconds.") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(player) .. " has been muted for " .. t[2] .. " seconds.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " is not currently online or cannot be muted.") end end return true end