• 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!

Lua COMMAND /MUTE FOR TUTORES

kaiquefb

New Member
Joined
Feb 18, 2010
Messages
62
Reaction score
0
Hello friends,

Use TFS 1.0 and would like to enable the mute command to my tutors.
The command is working for GM and GOD.
How do I TOGGLE the tutors?

mute.lua
Code:
function onSay(cid, words, param)
    local player = Player(cid)

    local target = Player(param)
    if target == nil then
        player:sendCancelMessage("A player with that name is not online.")
        return false
    end

    target:doaddCondition(CONDITION_MUTED)
    target:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been muted by " .. player:getName() .. ".")
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You muted " .. target:getName() .. ".")
end

Talkactions.xml
Code:
<talkaction words="/mute" script="mute.lua" />
 
groups.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<groups>
    <group id="1" name="Player" flags="0" access="0" maxdepotitems="0" maxvipentries="0" />
    <group id="2" name="Gamemaster" flags="137438953471" access="1" maxdepotitems="0" maxvipentries="200" />
    <group id="3" name="Administrator" flags="272730398714" access="1" maxdepotitems="0" maxvipentries="200" />
</groups>
 
someone could help me? I'm looking for the day and do not think a solution.

1º help.lua Channels ( With this script, I could do! Mute! Unmute work, only that no longer has the exhaust in the channel. )

Code:
local CHANNEL_HELP = 7

local muted = Condition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT)
muted:setParameter(CONDITION_PARAM_SUBID, CHANNEL_HELP)
muted:setParameter(CONDITION_PARAM_TICKS, 3600000)

function onSpeak(player, type, message)
    local playerAccountType = player:getAccountType()
    if player:getLevel() == 1 and playerAccountType == ACCOUNT_TYPE_NORMAL then
        player:sendCancelMessage("You may not speak into channels as long as you are on level 1.")
        return false
    end

    if player:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
        player:sendCancelMessage("You are muted from the Help channel for using it inappropriately.")
        return false
    end

    if playerAccountType >= ACCOUNT_TYPE_TUTOR then
        if string.sub(message, 1, 6) == "!mute " then
            local targetName = string.sub(message, 7)
            local target = Player(targetName)
            if target ~= nil then
                if playerAccountType > target:getAccountType() then
                    if not target:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
                        target:addCondition(muted)
                        sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " has been muted by " .. player:getName() .. " for using Help Channel inappropriately.")
                    else
                        player:sendCancelMessage("That player is already muted.")
                    end
                else
                    player:sendCancelMessage("You are not authorized to mute that player.")
                end
            else
                player:sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE)
            end
            return false
        elseif string.sub(message, 1, 8) == "!unmute " then
            local targetName = string.sub(message, 9)
            local target = Player(targetName)
            if target ~= nil then
                if playerAccountType > target:getAccountType() then
                    if target:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
                        target:removeCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP)
                        sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " has been unmuted by " .. player:getName() .. ".")
                    else
                        player:sendCancelMessage("That player is not muted.")
                    end
                else
                    player:sendCancelMessage("You are not authorized to unmute that player.")
                end
            else
                player:sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE)
            end
            return false
        end
    end

    if type == TALKTYPE_CHANNEL_Y then
        if playerAccountType >= ACCOUNT_TYPE_TUTOR or getPlayerFlagValue(player, PlayerFlag_TalkOrangeHelpChannel) then
            type = TALKTYPE_CHANNEL_O
        end
    elseif type == TALKTYPE_CHANNEL_O then
        if playerAccountType < ACCOUNT_TYPE_TUTOR and not getPlayerFlagValue(player, PlayerFlag_TalkOrangeHelpChannel) then
            type = TALKTYPE_CHANNEL_Y
        end
    elseif type == TALKTYPE_CHANNEL_R1 then
        if playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not getPlayerFlagValue(player, PlayerFlag_CanTalkRedChannel) then
            if playerAccountType >= ACCOUNT_TYPE_TUTOR or getPlayerFlagValue(player, PlayerFlag_TalkOrangeHelpChannel) then
                type = TALKTYPE_CHANNEL_O
            else
                type = TALKTYPE_CHANNEL_Y
            end
        end
    end
    return type
end

2º help.lua channels. ( This one is my original script, the 30-second exhaust work, more does not work the! Mute )

Code:
local CHANNEL_HELP = 7

local muted = createConditionObject(CONDITION_CHANNELMUTEDTICKS)
setConditionParam(muted, CONDITION_PARAM_SUBID, CHANNEL_HELP)
setConditionParam(muted, CONDITION_PARAM_TICKS, 60000)

local exhausted = createConditionObject(CONDITION_CHANNELMUTEDTICKS)
setConditionParam(exhausted, CONDITION_PARAM_SUBID, CHANNEL_HELP)
setConditionParam(exhausted, CONDITION_PARAM_TICKS, 60000)

function onSpeak(cid, type, message)
        local playerAccountType = Player(cid):getAccountType()
        if(Player(cid):getLevel() == 1 and playerAccountType == ACCOUNT_TYPE_NORMAL) then
                Player(cid):sendCancelMessage("You may not speak into channels as long as you are on level 1.")
                return false
        end

        if(getCreatureCondition(cid, CONDITION_CHANNELMUTEDTICKS, CHANNEL_HELP)) then
                Player(cid):sendCancelMessage("You may only ask a question once every 60 seconds.")
                return false
        end
      
        if(playerAccountType < ACCOUNT_TYPE_TUTOR) then  
        doAddCondition(cid, exhausted)
        end

        if(type == TALKTYPE_CHANNEL_Y) then
                if(playerAccountType >= ACCOUNT_TYPE_TUTOR or getPlayerFlagValue(cid, PlayerFlag_TalkOrangeHelpChannel)) then
                        type = TALKTYPE_CHANNEL_O
                end
        elseif(type == TALKTYPE_CHANNEL_O) then
                if(playerAccountType < ACCOUNT_TYPE_TUTOR and not getPlayerFlagValue(cid, PlayerFlag_TalkOrangeHelpChannel)) then
                        type = TALKTYPE_CHANNEL_Y
                end
        elseif(type == TALKTYPE_CHANNEL_R1) then
                if(playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not getPlayerFlagValue(cid, PlayerFlag_CanTalkRedChannel)) then
                        if(playerAccountType >= ACCOUNT_TYPE_TUTOR or getPlayerFlagValue(cid, PlayerFlag_TalkOrangeHelpChannel)) then
                                type = TALKTYPE_CHANNEL_O
                        else
                                type = TALKTYPE_CHANNEL_Y
                        end
                end
        end
        return type
end
 
Last edited:
Back
Top