The following script has been tested but has its my first attempt on my own at scripting :), it well more then likley contain bugs :P
-- MainChat Locker and Cleaner [New API] by Tw?sT?d-d?v?l (28/10/07)
-- Version 1.01
-- Getting started with lua
-- Version 1.02
-- Added Mainchat locker
-- Added Rightclicker
-- Version 1.03
-- Added profiles (tested but might still be bugs)
cConfig = {
["Botname"] = "MainChat", -- Bot name
["Botdescription"] = "I clean and lock", -- Bot description
["Botmail"] = "clean@closet", -- Bot email
CanClean = {
[0] = 1, -- Master
[1] = 0, -- Operator
[2] = 0, -- Vip
[3] = 0, -- Registered User
},
Block = {
[-1] = 1, -- Unregistered User
[0] = 0, -- Master
[1] = 0, -- Operator
[2] = 0, -- Vip
[3] = 1, -- Registered User
},
MainChatLock = 1
}
CleaningCommand = "clean" -- Cleaner command
LockingCommand = "mainchat on" -- Lock Mainchat
UnlockingCommand = "mainchat off" -- Unlock Mainchat
function OnStartup()
Core.RegBot(cConfig.Botname,cConfig.Botdescription,cConfig.Botmail,true)
end
ChatArrival = function(User,Data)
Core.GetUserAllData(User)
local _,_,cmd = string.find(Data, "%b<>%s%p(%S+)|")
if cmd and (cmd == CleaningCommand) then
Core.SendToAll("<"..cConfig.Botname.."> Mainchat cleaning started by "..User.sNick)
Core.SendToAll("<"..cConfig.Botname.."> \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\tStill Cleaning Mainchat\n")
Core.SendToAll("<"..cConfig.Botname.."> \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\tMainchat cleaning finished\n")
return true
end
Core.GetUserAllData(User)
if User.bOperator then
local s,e,cmd,arg = string.find(Data, "%b<>%s([^ ]+)%s*([^|]*)")
if cmd and (cmd == "!mainchat") then
if (arg == "off") then
if cConfig.MainChatLock then
Core.SendToNick(User.sNick,"<"..cConfig.Botname.."> Main chat is already disabled for user access.")
else
Core.SendToAll("<"..cConfig.Botname.."> Temporarily main chat is disabled for user access.")
cConfig.MainChatLock = 1
end
elseif (arg == "on") then
if sMainChatLock then
Core.SendToAll("<"..cConfig.Botname.."> Main chat is now enabled for user access.")
cConfig.MainChatLock = nil
else
Core.SendToNick(User.sNick,"<"..cConfig.Botname.."> Main chat is already enabled for user access.")
end
else
Core.SendToNick(User.sNick,"<"..cConfig.Botname.."> Invalid argument. ( on / off )")
end
return true
end
end
if cConfig.Block[User.iProfile] == 1 then
Core.SendToNick(User.sNick,"<"..cConfig.Botname.."> Main chat is disabled for user access.")
return true
end
end
NewUserConnected = function(user)
Core.GetUserAllData(user)
if (cConfig.CanClean[user.iProfile] == 1) then
Core.SendToNick(user.sNick,"$UserCommand 1 3 MainChat\\Clean Mainchat$<%[mynick]> !clean|")
Core.SendToNick(user.sNick,"$UserCommand 1 3 MainChat\\Lock Mainchat$<%[mynick]> !mainchat off|")
Core.SendToNick(user.sNick,"$UserCommand 1 3 MainChat\\Unlock Mainchat$<%[mynick]> !mainchat on|")
Core.SendToNick(user.sNick,"<"..SetMan.GetString(21).."> Mainchat commands are enabled, see hub Rightclicker for more.")
end
end
OpConnected = NewUserConnected
Feel free to post comments and errors so i can fix/learn more :)
hello
I am using this script for ptokax 0.4.0.0RC2 and found tht there is some bug in the script
when i lock main chat it gets lock
but when i try to unlock the main chat it is still lock and doesnt gets unlock (i.e the unlock command is not working)
Fixed
-- MainChat Locker and Cleaner [New API] by Tw?sT?d-d?v?l (28/10/07)
-- Version 1.01
-- Getting started with lua
-- Version 1.02
-- Added Mainchat locker
-- Added Rightclicker
-- Version 1.03
-- Added profiles (tested but might still be bugs)
cConfig = {
["Botname"] = "MainChat", -- Bot name
["Botdescription"] = "I clean and lock", -- Bot description
["Botmail"] = "clean@closet", -- Bot email
CanClean = {
[0] = 1, -- Master
[1] = 0, -- Operator
[2] = 0, -- Vip
[3] = 0, -- Registered User
},
Block = {
[-1] = 1, -- Unregistered User
[0] = 0, -- Master
[1] = 0, -- Operator
[2] = 0, -- Vip
[3] = 1, -- Registered User
},
MainChatLock = 1
}
CleaningCommand = "clean" -- Cleaner command
LockingCommand = "mainchat on" -- Lock Mainchat
UnlockingCommand = "mainchat off" -- Unlock Mainchat
function OnStartup()
Core.RegBot(cConfig.Botname,cConfig.Botdescription,cConfig.Botmail,true)
end
ChatArrival = function(User,Data)
Core.GetUserAllData(User)
local _,_,cmd = string.find(Data, "%b<>%s%p(%S+)|")
if cmd and (cmd == CleaningCommand) then
Core.SendToAll("<"..cConfig.Botname.."> Mainchat cleaning started by "..User.sNick)
Core.SendToAll("<"..cConfig.Botname.."> \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\tStill Cleaning Mainchat\n")
Core.SendToAll("<"..cConfig.Botname.."> \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\tMainchat cleaning finished\n")
return true
end
Core.GetUserAllData(User)
if User.bOperator then
local s,e,cmd,arg = string.find(Data, "%b<>%s([^ ]+)%s*([^|]*)")
if cmd and (cmd == "!mainchat") then
if (arg == "on") then
if cConfig.MainChatLock then
Core.SendToNick(User.sNick,"<"..cConfig.Botname.."> Main chat is already disabled for user access.")
else
Core.SendToAll("<"..cConfig.Botname.."> Temporarily main chat is disabled for user access.")
cConfig.MainChatLock = 1
end
elseif (arg == "off") then
if cConfig.MainChatLock then
Core.SendToAll("<"..cConfig.Botname.."> Main chat is now enabled for user access.")
cConfig.MainChatLock = nil
else
Core.SendToNick(User.sNick,"<"..cConfig.Botname.."> Main chat is already enabled for user access.")
end
else
Core.SendToNick(User.sNick,"<"..cConfig.Botname.."> Invalid argument. ( on / off )")
end
return true
end
end
if cConfig.Block[User.iProfile] == 1 then
if cConfig.MainChatLock then
Core.SendToNick(User.sNick,"<"..cConfig.Botname.."> Main chat is disabled for user access.")
return true
end
end
end
NewUserConnected = function(user)
Core.GetUserAllData(user)
if (cConfig.CanClean[user.iProfile] == 1) then
Core.SendToNick(user.sNick,"$UserCommand 1 3 MainChat\\Clean Mainchat$<%[mynick]> !clean|")
Core.SendToNick(user.sNick,"$UserCommand 1 3 MainChat\\Lock Mainchat$<%[mynick]> !mainchat off|")
Core.SendToNick(user.sNick,"$UserCommand 1 3 MainChat\\Unlock Mainchat$<%[mynick]> !mainchat on|")
Core.SendToNick(user.sNick,"<"..SetMan.GetString(21).."> Mainchat commands are enabled, see hub Rightclicker for more.")
end
end
OpConnected = NewUserConnected
Thanks speedx
The script is working great
Howto change the default locked main chat with unlocked main chat?
change
MainChatLock = 1
to
MainChatLock = nil
Thank
Done some changes in this script since all i needed was the cleaning part.
But it takes 2 minutes before it cleans the main chat why ??
/regards swee
-- MainChat Locker and Cleaner [New API] by Tw?sT?d-d?v?l (28/10/07)
-- Version 1.01
-- Getting started with lua
-- Version 1.02
-- Added Mainchat locker
-- Added Rightclicker
-- Version 1.03
-- Added profiles (tested but might still be bugs)
cConfig = {
["Botname"] = "Main", -- Bot name
["Botdescription"] = "I clean", -- Bot description
["Botmail"] = "clean@closet", -- Bot email
CanClean = {
- = 1, -- Master
[1] = 0, -- Operator
[2] = 0, -- Vip
[3] = 0, -- Registered User
},
}
CleaningCommand = "clean" -- Cleaner command
function OnStartup()
Core.RegBot(cConfig.Botname,cConfig.Botdescription,cConfig.Botmail,true)
end
ChatArrival = function(User,Data)
Core.GetUserAllData(User)
local _,_,cmd = string.find(Data, "%b<>%s%p(%S+)|")
if cmd and (cmd == CleaningCommand) then
Core.SendToAll("<"..cConfig.Botname.."> Mainchat cleaning started by "..User.sNick)
Core.SendToAll("<"..cConfig.Botname.."> \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\tStill Cleaning Mainchat\n")
Core.SendToAll("<"..cConfig.Botname.."> \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\tMainchat cleaning finished\n")
return true
end
end
NewUserConnected = function(user)
Core.GetUserAllData(user)
if (cConfig.CanClean[user.iProfile] == 1) then
Core.SendToNick(user.sNick,"$UserCommand 1 3 Main\\Clean Mainchat$<%[mynick]> !clean|")
Core.SendToNick(user.sNick,"<"..SetMan.GetString(21).."> Mainchat commands are enabled, see hub Rightclicker for more.")
end
end
OpConnected = NewUserConnected
[/sub]
Try this
HERE (http://euro-op.no-ip.info:8080/files1/Mini-MainChat-Cleaner%20%7BNew%20API%7D.rar)
Yes that worked very nice thank you
/regards swee
Nps m8
Thx for this script its work very nice
[05:53:50] <MainChat> Invalid argument. ( on / off )<---- when i tried to lock mainchat by right click
[05:54:02] <?StIfFLEr??> !clean<?StIfFLEr??> <----- clean by right click
[05:54:12] <MainChat> Invalid argument. ( on / off )<----- unlock by right click
previous version was much better
yo.. nice script.. but i hav a situation. here on our lan, we are not allowed to open mainchat.. but jus for text commands.. we hav been allowed 4 charaters like +i etc.. but to use scripts like offline msging systems, games.. we need to have no mainchat restrictions..
so can this script be modified.. so as to allow 4 chars length only..(or mayb 2,3 depending) but if the input is a valid command.. it should allow that too.. :)
This script still contains bugs.. Even when main chat is locked, users can type in main..
can this be corrected ?
Modifications Required :
1] Lock main for certian nicks for a default time.. if more or less than default time, an option to specify the time.
2] A clear right click menu which contains "Lock Main-Chat" %[line:Lock Main-Chat For Whom ?] [ dialogue box for nick ]
3] Unlock mainchat for the nick after the default lock time. [ Also can be able unliock before default time manually ]
4] Lock main-chat only allowed by master.
5] Main objective of this script is to lock and unlock main-chat.. for cleaning theres already a different script.. It would be great if the clean command is removed.
6] Option to list nicks for whom main chat is locked.
It would make a wonderful script with these modifications..
I would like to see the modified version..
What is it? Request,Order? ;D ;)
Its a request..
Quote from: DeAn on 18 July, 2009, 19:38:16
This script still contains bugs.. Even when main chat is locked, users can type in main..
can this be corrected ?
Modifications Required :
1] Lock main for certian nicks for a default time.. if more or less than default time, an option to specify the time.
2] A clear right click menu which contains "Lock Main-Chat" %[line:Lock Main-Chat For Whom ?] [ dialogue box for nick ]
3] Unlock mainchat for the nick after the default lock time. [ Also can be able unliock before default time manually ]
4] Lock main-chat only allowed by master.
5] Main objective of this script is to lock and unlock main-chat.. for cleaning theres already a different script.. It would be great if the clean command is removed.
6] Option to list nicks for whom main chat is locked.
It would make a wonderful script with these modifications..
I would like to see the modified version..
1] Lock main for certian nicks for a default time.. if more or less than default time, an option to specify the time.
For this request use Mute script or gag command which is there in ptokax by default
5] Main objective of this script is to lock and unlock main-chat.. for cleaning theres already a different script.. It would be great if the clean command is removed.
For this request Its upto the scripter what he wants to add and what he dont
And for remaining request which are completely related to mute script made by mutor so u can search for that script in the forum
I agree to yahoo. 100% :)
Quote
1] Lock main for certian nicks for a default time.. if more or less than default time, an option to specify the time.
For this request use Mute script or gag command which is there in ptokax by default
The user can again type on main chat when he reconnects the hub..
Quote
5] Main objective of this script is to lock and unlock main-chat.. for cleaning theres already a different script.. It would be great if the clean command is removed.
For this request Its upto the scripter what he wants to add and what he dont
Agreed..
Quote
And for remaining request which are completely related to mute script made by mutor so u can search for that script in the forum
Mute is a command which mutes the user completely.. The thing I requested is that only main chat be disabled for certain nicks..
Search for Flexo AOI by madman there is a plug in called gag ball which will do what you want!
OK.. Thanks TZB :)
Thanks Mutor..
Quote from: †StIfFLEr†™ on 17 November, 2008, 01:25:47
[05:53:50] <MainChat> Invalid argument. ( on / off )<---- when i tried to lock mainchat by right click
[05:54:02] <†StIfFLEr†™> !clean<†StIfFLEr†™> <----- clean by right click
[05:54:12] <MainChat> Invalid argument. ( on / off )<----- unlock by right click
previous version was much better
I have this problem too, can some1 please fix this script ???
Hi
Its possible change that script for Block only the Private MSG?
And if its possible, only block unregusers
Sory my bad english.
-- MainChat Locker and Cleaner [New API] by Tw?sT?d-d?v?l (28/10/07)
-- Version 1.01
-- Getting started with lua
-- Version 1.02
-- Added Mainchat locker
-- Added Rightclicker
-- Version 1.03
-- Added profiles (tested but might still be bugs)
cConfig = {
["Botname"] = "MainChat", -- Bot name
["Botdescription"] = "I clean and lock", -- Bot description
["Botmail"] = "clean@closet", -- Bot email
CanClean = {
[0] = 1, -- Master
[1] = 0, -- Operator
[2] = 0, -- Vip
[3] = 0, -- Registered User
},
Block = {
[-1] = 1, -- Unregistered User
[0] = 0, -- Master
[1] = 0, -- Operator
[2] = 0, -- Vip
[3] = 1, -- Registered User
},
MainChatLock = nil,
}
CleaningCommand = "clean" -- Cleaner command
LockingCommand = "mainchat off" -- Lock Mainchat
UnlockingCommand = "mainchat on" -- Unlock Mainchat
function OnStartup()
Core.RegBot(cConfig.Botname,cConfig.Botdescription,cConfig.Botmail,true)
end
ChatArrival = function(User,Data)
Core.GetUserAllData(User)
local _,_,cmd = string.find(Data, "%b<>%s%p(%S+)|")
if cmd == "clean" and (cConfig.CanClean[User.iProfile] == 1) then
Core.SendToAll("Mainchat cleaning started by "..User.sNick..string.rep("\n",26).."Still Cleaning Mainchat\n"..string.rep("\n",26).."Mainchat cleaning finished\n")
return true
end
if User.bOperator then
local s,e,cmd,arg = string.find(Data, "%b<>%s([^ ]+)%s*([^|]*)")
if cmd and cmd == "!mainchat" then
if arg == "off" then
if cConfig.MainChatLock then
Core.SendToNick(User.sNick,"<"..cConfig.Botname.."> Main chat is already disabled for user access.")
else
Core.SendToAll("<"..cConfig.Botname.."> Main chat is temporarily disabled for user access.")
cConfig.MainChatLock = 1
end
elseif arg == "on" then
if cConfig.MainChatLock then
Core.SendToAll("<"..cConfig.Botname.."> Main chat is now enabled for user access.")
cConfig.MainChatLock = nil
else
Core.SendToNick(User.sNick,"<"..cConfig.Botname.."> Main chat is already enabled for user access.")
end
else
Core.SendToNick(User.sNick,"<"..cConfig.Botname.."> Invalid argument. ( on / off )")
end
return true
end
end
if cConfig.Block[User.iProfile] == 1 then
if cConfig.MainChatLock then
Core.SendToNick(User.sNick,"<"..cConfig.Botname.."> Main chat is curently disabled for user access.")
return true
end
end
end
OpConnected = function(user)
Core.GetUserAllData(user)
if (cConfig.CanClean[user.iProfile] == 1) then
Core.SendToNick(user.sNick,"$UserCommand 1 3 MainChat\\Clean Mainchat$<%[mynick]> !clean||")
end
Core.SendToNick(user.sNick,"$UserCommand 1 3 MainChat\\Lock Mainchat$<%[mynick]> !mainchat off||")
Core.SendToNick(user.sNick,"$UserCommand 1 3 MainChat\\Unlock Mainchat$<%[mynick]> !mainchat on||")
Core.SendToNick(user.sNick,"<"..SetMan.GetString(21).."> Mainchat commands are enabled, see hub Rightclicker for more.")
end