• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS 0.X TFS 0.3.6 - LUA - Command /mute channels

samuel157

/root
Joined
Mar 19, 2010
Messages
608
Solutions
4
Reaction score
120
Location
São Paulo, Brazil
GitHub
Samuel10M
TFS 0.3.6 - LUA - Command /mute channel


It works, but when the player disconnects again, it continues to display the message...


LUA:
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
 
Last edited:
Solution
LUA:
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 storageMute = 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)
    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...
LUA:
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 storageMute = 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)
    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])
                -- Salva o tempo de expiração do mute no storage do jogador mutado
                setPlayerStorageValue(playerMuted, storageMute, 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
 
Solution
Back
Top