1local CHANNEL_HELP = 7
2
3local muted = Condition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT)
4muted:setParameter(CONDITION_PARAM_SUBID, CHANNEL_HELP)
5muted:setParameter(CONDITION_PARAM_TICKS, 3600000)
6
7function onSpeak(player, type, message)
8 local playerAccountType = player:getAccountType()
9 if player:getLevel() == 1 and playerAccountType == ACCOUNT_TYPE_NORMAL then
10
11 return false
12 end
13
14 if player:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
15
16 return false
17 end
18
19 if playerAccountType >= ACCOUNT_TYPE_TUTOR then
20 if string.sub(message, 1, 6) == "!mute " then
21 local targetName = string.sub(message, 7)
22 local target = Player(targetName)
23 if target then
24 if playerAccountType > target:getAccountType() then
25 if not target:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
26 target:addCondition(muted)
27 sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " foi silenciado por " .. player:getName() .. " por usar o Canal de Ajuda de forma inadequada.")
28 else
29
30 end
31 else
32
33 end
34 else
35 player:sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE)
36 end
37 return false
38 elseif string.sub(message, 1, 8) == "!unmute " then
39 local targetName = string.sub(message, 9)
40 local target = Player(targetName)
41 if target then
42 if playerAccountType > target:getAccountType() then
43 if target:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
44 target:removeCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP)
45 sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " has been unmuted by " .. player:getName() .. ".")
46 else
47
48 end
49 else
50
51 end
52 else
53 player:sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE)
54 end
55 return false
56 end
57 end
58
59 if type == TALKTYPE_CHANNEL_Y then
60 if playerAccountType >= ACCOUNT_TYPE_TUTOR or player:hasFlag(PlayerFlag_TalkOrangeHelpChannel) then
61 type = TALKTYPE_CHANNEL_O
62 end
63 elseif type == TALKTYPE_CHANNEL_O then
64 if playerAccountType < ACCOUNT_TYPE_TUTOR and not player:hasFlag(PlayerFlag_TalkOrangeHelpChannel) then
65 type = TALKTYPE_CHANNEL_Y
66 end
67 elseif type == TALKTYPE_CHANNEL_R1 then
68 if playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not player:hasFlag(PlayerFlag_CanTalkRedChannel) then
69 if playerAccountType >= ACCOUNT_TYPE_TUTOR or player:hasFlag(PlayerFlag_TalkOrangeHelpChannel) then
70 type = TALKTYPE_CHANNEL_O
71 else
72 type = TALKTYPE_CHANNEL_Y
73 end
74 end
75 end
76 return type
77end
78