function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
local split = param:split(",")
if split[3] == nil then
player:sendCancelMessage("Insufficient parameters. /muted playername, channel Id, time, reason.")
return false
end
local target = Player(split[1])
if target == nil then
player:sendCancelMessage("A player with that name is not online.")
return false
end
local channelId = tonumber(split[2])
if type(channelId) ~= 'number' or channelId > 8 then
player:sendCancelMessage("Channel ID is invalid.")
return false
end
local mutedTime = tonumber(split[3])
if type(mutedTime) ~= 'number' then
player:sendCancelMessage("Muted time is invalid.")
return false
end
local reasonText = ""
if reasonTime ~= nil then
reasonTime = tostring(split[4])
end
local muted = Condition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT)
muted:setParameter(CONDITION_PARAM_SUBID, channelId)
muted:setParameter(CONDITION_PARAM_TICKS, mutedTime * 60 * 1000)
target:addCondition(muted)
sendChannelMessage(channelId, TALKTYPE_CHANNEL_O, string.format("Player %s has been muted for %d minutes. Reason: %s.", target:getName(), mutedTime, reasonText))
return false
end