PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: chaggydawg on 28 April, 2004, 18:28:24

Title: MultiProfile Chat
Post by: chaggydawg on 28 April, 2004, 18:28:24
I wrote this for my hub, maybe someone else can use it too...  Enjoy...  ;)

Oh, if you add any new ops or whatever, you must restart the script to rebuild profile tables... maybe I'll add a command for it, but prolly not....

--// MultiProfile Chat Room
--// By Chaggydawg
--// This is a multiprofile Secondary Chat Bot, You could in theory rename script and bot and run mutliple seperate chats too
--// Uncomment and Rename People# Profiles appropriately ("within quotes")
--// Prolly a bunch of these around, But I wrote it, so I'm sharing it, plus its nice and simple ;)
--// Version... oh I don't know... v17.1854a   yah that looks good....

BotName = "AdminChat"


--// Uncomment who will use this chat, also possible to change profile names, but don't try to add People6, etc.
People1 = GetUsersByProfile("Master")
People2 = GetUsersByProfile("Administrator")
--//People3 = GetUsersByProfile("Operator")
--//People4 = GetUsersByProfile("VIP")
--//People5 = GetUsersByProfile("Reg")

function Main()
frmHub:RegBot(BotName)
end

function DataArrival(curUser,Data)
s,e,mess = strfind(Data,"%b<>%s+(.*)")
if strsub(Data,1,3) == "$To" and strsub(Data,6,strlen(BotName)+5) == BotName then
DoChatter(curUser,mess)
end
end

function DoChatter(curUser,mess)
if (People1) then
for i,v in People1 do
if strlower(v) ~= strlower(curUser.sName) then
   SendToNick(v, "$To: "..v.." From: "..BotName.." $<"..curUser.sName.."> "..mess)
end
end
end
if (People2) then
for i,v in People2 do
if strlower(v) ~= strlower(curUser.sName) then
   SendToNick(v, "$To: "..v.." From: "..BotName.." $<"..curUser.sName.."> "..mess)
end
end
end
if (People3) then
for i,v in People3 do
if strlower(v) ~= strlower(curUser.sName) then
   SendToNick(v, "$To: "..v.." From: "..BotName.." $<"..curUser.sName.."> "..mess)
end
end
end
if (People4) then
for i,v in People4 do
if strlower(v) ~= strlower(curUser.sName) then
   SendToNick(v, "$To: "..v.." From: "..BotName.." $<"..curUser.sName.."> "..mess)
end
end
end
if (People5) then
for i,v in People5 do
if strlower(v) ~= strlower(curUser.sName) then
   SendToNick(v, "$To: "..v.." From: "..BotName.." $<"..curUser.sName.."> "..mess)
end
end
end
end