Well, after a struggle to get the mute system to work by the help of Cyktotitan we got a pretty cool mute script xD!
Works on 0.2
Works on 0.2
Lua:
string.explode = function (str, sep)
local pos, t = 1, {}
if #sep == 0 or #str == 0 then
return
end
for s, e in function() return str:find(sep, pos) end do
table.insert(t, str:sub(pos, s - 1):trim())
pos = e + 1
end
table.insert(t, str:sub(pos):trim())
return t
end
local conditions = {}
for i = 1, 100 do
table.insert(conditions, createConditionObject(CONDITION_MUTED))
setConditionParam(conditions[i], CONDITION_PARAM_TICKS, i * 60 * 1000)
end
function onSay(cid, words, param)
local t = string.explode(param, ",")
local target = getPlayerByNameWildcard(t[1])
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires a players name and number.")
return TRUE
end
if(getPlayerGroupId(target) > 1) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot Mute another Staff member.")
return TRUE
end
if(not target) then
target = getCreatureByName(param)
if(not target) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player is not online.")
return TRUE
end
end
doAddCondition(target, conditions[tonumber(t[2])])
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have muted "..getCreatureName(target).." for "..t[2]..".")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_SLEEP)
return TRUE
end
Code:
/mute Name, Duration -- (Duration is in Minutes)
Last edited: