Can someone nice dude make this...
Something like this?
-- Profiles not allowed to type in Main
tBlocked = {
[-1] = 1, -- Unreg
[0] = 0, -- Master
[1] = 0, -- Operator
[2] = 0, -- VIP
[3] = 1, -- Reg
[4] = 0, -- Moderator
[5] = 0, -- Founder
}
ChatArrival = function(user,data)
if tBlocked[user.iProfile] == 1 then
return user:SendData(frmHub:GetHubBotName(),"*** Error: Main Chat is blocked for your profile!"), 1
end
end
yeah this is a good but can it have on/of mouse commands included ... i dont wanna use startscript/stopscript
Quote from: Northwind on 22 March, 2006, 20:44:17
yeah this is a good but can it have on/of mouse commands included ... i dont wanna use startscript/stopscript
Sure. I'll post it later today.
Cheers
Another attempt...
--[[
Main Censor 1.0 LUA 5.1 (3/23/2006)
By jiten
]]--
tSettings = {
sBot = frmHub:GetHubBotName(),
fCensor = "tCensor.tbl", tCensor = {}, tLevels = {},
sSetup = "mainchat", sList = "list",
}
Main = function()
if loadfile(tSettings.fCensor) then dofile(tSettings.fCensor) end
for a,b in pairs(GetProfiles()) do
tSettings.tLevels[a] = b
end
tSettings.tLevels[-1] = "Unreg"; tSettings.tLevels["unreg"] = -1
end
ChatArrival = function(user,data)
local tmp = tSettings.tCensor[user.iProfile]
if tmp and tmp == 1 then
return user:SendData(tSettings.sBot,"*** Your profile is not allowed to talk in Main Chat!"), 1
else
local s,e,cmd = string.find(data,"^%b<>%s+[%!%+](%S+).*|$")
-- If cmd and tCmds contains it
if cmd then
-- Lower it
cmd = string.lower(cmd)
-- If user is allowed to use
if tCmds[cmd].tLevels[user.iProfile] then
return tCmds[cmd].tFunc(user,data), 1
else
return user:SendData(tSettings.sBot,"*** Error: You are not allowed to use this command."), 1
end
end
end
end
NewUserConnected = function(user)
for i,v in pairs(tCmds) do
if v.tLevels[user.iProfile] then user:SendData("$UserCommand 1 3 Main Censor\\"..v.tRC.."|") end
end
end
OpConnected = NewUserConnected
tCmds = {
[tSettings.sSetup] = {
tFunc = function(user,data)
local s,e,profile,flag = string.find(data,"^%b<>%s+%S+%s+(%S+)%s+(%S+).*|$")
if profile and flag then
local tmp; tmp = tonumber(profile) or GetProfileIdx(profile)
if string.lower(profile) == "unreg" then tmp = -1 end; flag = string.lower(flag)
if tSettings.tLevels[tmp] then
local tSetup = {
["on"] = function()
tSettings.tCensor[tmp] = 1; OnExit()
user:SendData(tSettings.sBot,"*** Main Chat has been blocked for "..profile.."!")
end,
["off"] = function()
tSettings.tCensor[tmp] = 0; OnExit()
user:SendData(tSettings.sBot,"*** Main Chat has been enabled for "..profile.."!")
end,
}
if tSetup[flag] then
tSetup[flag]()
else
user:SendData(tSettings.sBot,"*** Error: The flag should be <on/off>")
end
else
user:SendData(tSettings.sBot,"*** Error: "..profile.." doesn?t exist!")
end
else
user:SendData(tSettings.sBot,"*** Syntax Error: Type !"..tSettings.sSetup.." <Profile ID/Name> <on/off>")
end
end,
tLevels = {
[0] = 1,
[5] = 1,
},
tRC = "Enable/Disable$<%[mynick]> !"..tSettings.sSetup.." %[line:Profile ID or Name] %[line:on/off]"
},
[tSettings.sList] = {
tFunc = function(user)
if next(tSettings.tCensor) then
local sMsg = "\r\n\r\n".."\t"..string.rep("- -",20).."\r\n\t\tBlocked Profiles List:\r\n\t"..
string.rep("- -",20).."\r\n"
for i,v in pairs(tSettings.tCensor) do
local tmp = "*unblocked*"; if tonumber(v) == 1 then tmp = "*blocked*" end
sMsg = sMsg.."\r\n\t? "..(GetProfileName(i) or "Unreg").."\t "..tmp
end
user:SendData(tSettings.sBot,sMsg)
else
user:SendData(tSettings.sBot,"*** Error: Main Block list is empty!")
end
end,
tLevels = {
[0] = 1,
[5] = 1,
},
tRC = "List Blocked Profiles$<%[mynick]> !"..tSettings.sList
}
}
OnExit = function()
local hFile = io.open(tSettings.fCensor,"w+") Serialize(tSettings.tCensor,"tSettings.tCensor",hFile); hFile:close()
end
Serialize = function(tTable,sTableName,hFile,sTab)
sTab = sTab or "";
hFile:write(sTab..sTableName.." = {\n");
for key,value in pairs(tTable) do
if (type(value) ~= "function") then
local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
if(type(value) == "table") then
Serialize(value,sKey,hFile,sTab.."\t");
else
local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
hFile:write(sTab.."\t"..sKey.." = "..sValue);
end
hFile:write(",\n");
end
end
hFile:write(sTab.."}");
end
Whilst this an old post, im hoping someone can help.
The script works fine under normal circumstances, but, if a user puts a space first before any text, then the text is allowed to filter through to the main chat.
Is there any workaround for this?
regards
Thank you for your reply mutor,
I did indeed try your script, but i get the following error:
\scripts\chatblocker.lua:111: attempt to call global 'ChatCmds' (a nil value)
And no right click commands are available even after restarting scripts, and rejoining the hub.
regards
Hey, try this one ... -- ======================================================== --
--// MainLock by GeceBekcisi, 22.11.2005
-- ======================================================== --
sMainChatLock = nil
sBot = frmHub:GetHubBotName()
-- ======================================================== --
function ChatArrival(curUser, data)
data = string.sub(data, 1, string.len(data)-1)
if curUser.bOperator then
local s,e,cmd,arg = string.find(data,"%b<>%s+(%S+)%s+(%S+)")
if (cmd == "!mainchat") then
if (arg == "off") then
if sMainChatLock then
curUser:SendData(sBot, "Mainchat is already disabled for user access.")
else
SendToAll(sBot, "Temporarily Mainchat is disabled for user access.")
sMainChatLock = 1
end
end
if (arg == "on") then
if sMainChatLock then
SendToAll(sBot, "Mainchat is now enabled for user access.")
sMainChatLock = nil
else
curUser:SendData(sBot, "Mainchat is already enabled for user access.")
end
end
return 1
end
end
if sMainChatLock then
if curUser.bOperator then
return 0
else
curUser:SendData(sBot, "Mainchat is disabled for user access.")
return 1
end
end
end
-- ======================================================== --
--// MainLock by GeceBekcisi, 22.11.2005
--// Modded by TTB, 07-12-2005
--// Fixed small bug by 6Marilyn6Manson6, 07-12-2005
-- ======================================================== --
sMainChatLock = nil
sBot = frmHub:GetHubBotName()
Block = {
[-1] = 1, -- Users
[0] = 1, -- Masters
[1] = 1, -- OPs
[2] = 1, -- VIPs
[3] = 1, -- REGs
[4] = 1, -- MODs
[5] = 1, -- Founders
[6] = 1, -- Owners
}
-- ======================================================== --
function ChatArrival(curUser, data)
data = string.sub(data, 1, string.len(data)-1)
if curUser.bOperator then
local s,e,cmd,arg = string.find(data,"%b<>%s+(%S+)%s+(%S+)")
if (cmd == "!mainchat") then
if (arg == "off") then
if sMainChatLock then
curUser:SendData(sBot, "Main chat is already disabled for user access.")
else
SendToAll(sBot,curUser.sName.." killed main chat :P")
sMainChatLock = 1
end
end
if (arg == "on") then
if sMainChatLock then
SendToAll(sBot, "Main chat is now back to normal.")
sMainChatLock = nil
else
curUser:SendData(sBot, "Main chat is already enabled for user access.")
end
end
return 1
end
end
if sMainChatLock then
if Block[curUser.iProfile] == 1 then
curUser:SendData(sBot, "Main chat is disabled for user access.")
return 1
else
return 0
end
end
end
Quote from: Magic-al on 20 August, 2006, 01:47:32
The script works fine under normal circumstances, but, if a user puts a space first before any text, then the text is allowed to filter through to the main chat.
Which code are you referring to?
I had a look at both mine and this doesn't seem to happen.
-- ======================================================== --
--// MainLock by GeceBekcisi, 22.11.2005
--// Modded by TTB, 07-12-2005
--// Small changes by NightLitch, 20-08-2006
-- ======================================================== --
sMainChatLock = nil
sBot = frmHub:GetHubBotName()
Block = {
[-1] = 1, -- Users
[0] = 0, -- Masters
[1] = 0, -- OPs
[2] = 0, -- VIPs
[3] = 0, -- REGs
[4] = 0, -- MODs
[5] = 0, -- Founders
}
-- ======================================================== --
function ChatArrival(usr, data)
if usr.bOperator then
local s,e,cmd,arg = string.find(data,"%b<>%s([^ ]+)%s*([^|]*)")
if cmd and (cmd == "!mainchat") then
if (arg == "off") then
if sMainChatLock then
usr:SendData(sBot, "Main chat is already disabled for user access.")
else
SendToAll(sBot, "Temporarily main chat is disabled for user access.")
sMainChatLock = 1
end
elseif (arg == "on") then
if sMainChatLock then
SendToAll(sBot, "Main chat is now enabled for user access.")
sMainChatLock = nil
else
usr:SendData(sBot, "Main chat is already enabled for user access.")
end
else
usr:SendData(sBot, "Invalid argument. ( on / off )")
end
return 1
end
end
if sMainChatLock and Block[usr.iProfile] == 1 then
usr:SendData(sBot, "Main chat is disabled for user access.")
return 1
end
end
--// 6Marilyn6Manson6
This work without any problem :)
Thank you all for your help
6Marilyn6Manson6, i opted for yours, and yep, does exactly what i need.
thanks again
regards
;D
" write on for the writeous "
Quote from: Mutor on 20 August, 2006, 14:56:51
You could and should respond to the posts by jiten and myself. If there are problems
with script, we who actually WRITE them from scratch would like to know if their are bugs
or if users are just not using them properly or not copying tjem from the page correctly.
A little feedback is a small concession for the work input to meet these requests.
I second your post, as I'm also curious about Magic-al's report.
Quote from: Mutor on 20 August, 2006, 14:56:51
Well I'm glad your content. But for the record the script posted by 6M6M6 is not his.
I really should put my thinking head on before i type. What i was referring to in my reply to manson, was thanking him for his post pointing me in the right direction, The script he posted clearly states credit to whom the script was created by:
--// MainLock by GeceBekcisi, 22.11.2005
--// Modded by TTB, 07-12-2005
--// Fixed small bug by 6Marilyn6Manson6, 07-12-2005
--// Small changes by NightLitch, 20-08-2006
I am not a scriptor by any means, but all i know is that with my configuration, the script manson posted, was the only one that seemed to work for me.
Like many others here, i admire the scripting you folks come up with, and wouldnt have a hope in hell of managing with out you guys.
I hope no offence was taken, as none was intended.
regards
Well, no offense was taken.
We just wanted to know from which script [from those previously three] did you get that problem and how did it happen, as all of them [also pointed by Mutor] do what you request.
And if it's really a bug, it will surely be fixed.
Quote from: jiten on 20 August, 2006, 19:13:56
Well, no offense was taken.
We just wanted to know from which script [from those previously three] did you get that problem and how did it happen, as all of them [also pointed by Mutor] do what you request.
And if it's really a bug, it will surely be fixed.
Jiten, i tried all 3 scripts, and all worked as should, unless a user put a space in front of text. Now it is quite possible that i may of not copied correctly, and hence the script didnt do as intended, im sure there would of been bug reports prior to mine if there had been any.
All i know is the script i finally choose, worked for me. It is more than likeley my set up that may have been causing a possible conflict. In summary, i have no idea why this worked, and others failed.
regards
Quote from: Mutor on 20 August, 2006, 22:04:40
I did not mean that there were credits removed. Just wanted all to be sure
that this was not 6Marilyn6Manson6's code, thats all.
All these scripts work, some have additional features, we just like to confirm problems
if they do indeed, exist. No offense taken or intended.
I have removed my comment from this script:
-- ======================================================== --
--// MainLock by GeceBekcisi, 22.11.2005
--// Modded by TTB, 07-12-2005
--// Small changes by NightLitch, 20-08-2006
-- ======================================================== --
but now stop war please :). I don't want war here, sorry for all Mutor, but please stop this war between me and you
For the sake of goodness, stop this, I don't wanna sit here all night long, splittin' this thread. :P