work
code-----------------------------------------
---------------------------------------------------------------------------------------------------------------------
-- MUTE
--cmd gag work to cmd ungag
---------------------------------------------------------------------------------------------------------------------
sBot = "-MUTE-"
MUTE = {}
function ChatArrival(user, data)
if (string.sub(data,1,1) == "<") then
data=string.sub(data,1,string.len(data)-1)
s,e,cmd = string.find(data,"%b<>%s+(%S+)")
if ((cmd=="+gag")) and user.bOperator then
DoMute(user, data) return 1
elseif cmd == "+showgag" and user.bOperator then
function MUTED()
local disp = ""
for index, value in MUTE do
local line = index
disp = disp.."\t ? "..line.."\r\n"
end
return disp
end
user:SendPM(sBot,"\r\n\r\n\t\t\t\t\t(? ?.??.-> These are the muted <-.??.???)\r\n\r\n"..MUTED().."|")
return 1
elseif ((cmd=="+ungag")) and user.bOperator then
DoUnMute(user, data) return 1
end
if string.sub(data,1,1) == "<" then
if MUTE[user.sName] == 1 then return 1
end
end
end
end
function DoMute(user, data)
local s,e,cmd,vic = string.find(data,"%b<>%s+(%S+)%s+(%S+)")
local victim = GetItemByName(vic)
if victim == nil then
user:SendData(sBot,"User is not in the hub...")
else
if MUTE[victim.sName] == nil then
MUTE[victim.sName] = 1
SendToAll(sBot,"He, he "..victim.sName..", you txt not speak ;)")
end
end
end
function DoUnMute(user, data)
local s,e,cmd,vic = string.find(data,"%b<>%s+(%S+)%s+(%S+)")
local victim = GetItemByName(vic)
if victim == nil then
user:SendData(sBot,"User is not in the hub...")
else
if MUTE[victim.sName] == 1 then
MUTE[victim.sName] = nil;
SendToAll(sBot, victim.sName.." you txt allow speak ;) ")
end
end
end
Can someone add a profile protection to this script?
Like, Op's can be immune, and vip's can only gag reg/unreg
Something like this?
---------------------------------------------------------------------------------------------------------------------
-- Mute script
-- changed a bit by jiten
---------------------------------------------------------------------------------------------------------------------
sBot = "-MUTE-"
tMute = {}
AllowedProfiles = {
-- [Gagger Profile Number] = {
-- [Gagged Profile Number] = 0 --> can't gag victim; 1 --> can gag victim
-- },
[1] = { [1] = 1, [2] = 1, [3] = 1, [4] = 0, [5] = 0, [0] = 0, [-1] = 1, },
[2] = { [1] = 0, [2] = 1, [3] = 1, [4] = 0, [5] = 0, [0] = 0, [-1] = 1, },
[4] = { [1] = 1, [2] = 1, [3] = 1, [4] = 1, [5] = 0, [0] = 0, [-1] = 1, },
[5] = { [1] = 1, [2] = 1, [3] = 1, [4] = 1, [5] = 1, [0] = 1, [-1] = 1, },
[0] = { [1] = 1, [2] = 1, [3] = 1, [4] = 1, [5] = 0, [0] = 1, [-1] = 1, },
}
function ChatArrival(user, data)
local data=string.sub(data,1,-2)
local s,e,cmd = string.find(data,"%b<>%s+(%S+)")
if AllowedProfiles[user.iProfile] or user.bOperator then
if ((cmd=="+gag")) then
DoMute(user, data) return 1
elseif cmd == "+showgag" then
local disp = ""
for index, value in tMute do
local line = index
disp = disp.."\t ? "..line.."\r\n"
end
user:SendPM(sBot,"\r\n\r\n\t\t\t\t\t(? ?.??.-> These are the muted <-.??.???)\r\n\r\n"..disp.."|")
return 1
elseif ((cmd=="+ungag")) then
DoUnMute(user, data) return 1
end
end
if tMute[user.sName] == 1 then return 1 end
end
function DoMute(user, data)
local s,e,cmd,vic = string.find(data,"%b<>%s+(%S+)%s+(%S+)")
local victim = GetItemByName(vic)
if victim == nil then
user:SendData(sBot,"User is not in the hub...")
else
if AllowedProfiles[user.iProfile][victim.iProfile] == 1 then
if tMute[victim.sName] == nil then
tMute[victim.sName] = 1
SendToAll(sBot,"He, he "..victim.sName..", you txt not speak ;)")
end
else
if not victim.bRegistered then
user:SendData(sBot,"*** Error: You can't gag Users!")
else
user:SendData(sBot,"*** Error: You can't gag "..GetProfileName(victim.iProfile).."s!")
end
end
end
end
function DoUnMute(user, data)
local s,e,cmd,vic = string.find(data,"%b<>%s+(%S+)%s+(%S+)")
local victim = GetItemByName(vic)
if victim == nil then
user:SendData(sBot,"User is not in the hub...")
else
if tMute[victim.sName] == 1 then
tMute[victim.sName] = nil;
SendToAll(sBot, victim.sName.." you txt allow speak ;) ")
end
end
end
well, it looks exactly what i asked for :P
Thx a lot, and once again jiten :]
I will try it out...
*edited*
Tried it now... it works great, but the immune profiles table doesnt makes much sense...if i make a profile immune, the script wont work on it, and the user anyway gets gagged by ptokax inbuilt cmd's, thats why i had so much trouble trying to make it on my own...
but thx a lot, with the allowed profile table its just perfect
QuoteOriginally posted by [AT]conejodelmal
well, it looks exactly what i asked for :P
Thx a lot, and once again jiten :]
I will try it out...
*edited*
Tried it now... it works great, but the immune profiles table doesnt makes much sense...if i make a profile immune, the script wont work on it, and the user anyway gets gagged by ptokax inbuilt cmd's, thats why i had so much trouble trying to make it on my own...
but thx a lot, with the allowed profile table its just perfect
That was exactly my doubt when I was editing the script.
It's way better to use only the AllowedProfile table as it really doesn't make sense :D
So, I updated the first script with something more logical.
Cheers
Its just perfect, thx again