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

CHANNEL HELP

_M4G0_

Intermediate OT User
Joined
Feb 6, 2016
Messages
550
Solutions
17
Reaction score
108
i inserted tag for tutors, but the channel dont have exhausted
someone help?


local CHANNEL_HELP = 7

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

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

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


if playerAccountType == ACCOUNT_TYPE_TUTOR then
sendChannelMessage(7, type, "[" .. tutor .. "]" .. player:getName() .. ": ".. message)
return false
elseif
playerAccountType >= ACCOUNT_TYPE_GAMEMASTER then
type = TALKTYPE_CHANNEL_R1
sendChannelMessage(7, type, "" .. Adm .. "" .. player:getName() .. ": ".. message)
return false
else
type = TALKTYPE_CHANNEL_Y
sendChannelMessage(7, type, player:getName() .. ": " .. message)
return false
end

if(getCreatureCondition(player, CONDITION_CHANNELMUTEDTICKS, CHANNEL_HELP)) and playerAccountType == ACCOUNT_TYPE_NORMAL then
player:sendCancelMessage("You may only ask a question once every 30 seconds.")
return false
end

if getPlayerGroupId(player) <= 1 then
doAddCondition(player, exhausted)
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
if playerAccountType >= ACCOUNT_TYPE_GAMEMASTER then
type = TALKTYPE_CHANNEL_R1
end
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

BUMP
 
Last edited by a moderator:
Solution
try this, i tested with chat channel 11 so change it at the top
seems to work fine for me unless i missed something
Code:
local CHANNEL_HELP = 11

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

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

function onSpeak(player, type, message)
    local playerAccountType = player:getAccountType()
    if player:getLevel() <= 3 and playerAccountType == ACCOUNT_TYPE_NORMAL then
        player:sendCancelMessage("You may not...
try this, i tested with chat channel 11 so change it at the top
seems to work fine for me unless i missed something
Code:
local CHANNEL_HELP = 11

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

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

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


    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(getCreatureCondition(player, CONDITION_CHANNELMUTEDTICKS, CHANNEL_HELP)) and playerAccountType == ACCOUNT_TYPE_NORMAL then
        player:sendCancelMessage("You may only ask a question once every 30 seconds.")
        return false
    end

    if player:getGroup():getId() <= 1 then
        player:addCondition(exhausted)
    end

    if playerAccountType >= ACCOUNT_TYPE_TUTOR then
        print("cheese")
        if string.match(message, "!mute") then
            print("mute")
            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
                        print(1)
                        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
                    print(2)
                    player:sendCancelMessage("You are not authorized to mute that player.")
                end
            else
                print(3)
                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
            if playerAccountType >= ACCOUNT_TYPE_GAMEMASTER then
                type = TALKTYPE_CHANNEL_R1
            end
        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

    if playerAccountType == ACCOUNT_TYPE_TUTOR then
        sendChannelMessage(CHANNEL_HELP, type, "[" .. tutor .. "]" .. player:getName() .. ": ".. message)
        return false
    elseif playerAccountType >= ACCOUNT_TYPE_GAMEMASTER then
        type = TALKTYPE_CHANNEL_R1
        sendChannelMessage(CHANNEL_HELP, type, "" .. Adm .. "" .. player:getName() .. ": ".. message)
        return false
    else
        type = TALKTYPE_CHANNEL_Y
        sendChannelMessage(CHANNEL_HELP, type, player:getName() .. ": " .. message)
        return false
    end

    return true
end
 
Solution
the problem was the order of execution, you had the message send before all of the type changes and mute checks
 
Back
Top