Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onSay(cid, words, param, channel)
- if(param == '') then
- doPlayerSendTextMessage(cid, 21, "[Ex: /mute NAME, Seconds OR /desmute NAME]")
- return true
- end
- local t = string.explode(param, ",")
- player = getPlayerByName(t[1])
- if (words == "/mute") or (words == "!mute") then
- if(not t[2] or t[2] == '') then
- doPlayerSendTextMessage(cid, 21, "Example [/mute NAME, Seconds]")
- return true
- end
- if t[2] then
- tempo = tonumber(t[2]*1000)
- local condition = createConditionObject(CONDITION_MUTED)
- setConditionParam(condition, CONDITION_PARAM_TICKS, tempo)
- local infight = createConditionObject(CONDITION_INFIGHT)
- setConditionParam(infight, CONDITION_PARAM_TICKS, tempo)
- if(isPlayer(player) == TRUE and getPlayerGroupId(cid) > getPlayerGroupId(player) and getPlayerFlagValue(player, PLAYERFLAG_CANNOTBEMUTED) == false) then
- doAddCondition(player, condition)
- doAddCondition(player, infight)
- 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
- elseif (words == "/desmute") or (words == "!desmute") then
- if(isPlayer(player) == TRUE and getPlayerGroupId(cid) > getPlayerGroupId(player))then
- if getCreatureCondition(player, CONDITION_MUTED) then
- doRemoveCondition(player, CONDITION_MUTED)
- doRemoveCondition(player, CONDITION_INFIGHT)
- doPlayerSendTextMessage(player, MESSAGE_STATUS_WARNING, "You have been desmuted by " .. getPlayerName(cid) .. ".")
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(player) .. " has been desmuted.")
- else
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " is not muted.")
- end
- else
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " is not currently online or cannot be muted.")
- end
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment