--------Oblvion Ver 1.1 made by Matt -- with thx to plop for all his help and suport -- with thx to all that have helped me you know whou you are nerbos nighlitch hawk --- thx to all Bot = "Oblivion" HubName = frmHub:GetHubName() HubOwner = "[TLG]Matt" PMSpy = "1" -- The Message File MessageFile = "butler/messages.txt" -- The Message Table tMessages = {} Sec = 1000 Min = 60 * Sec Hour = 60 * Min Day = 24 * Hour botemail = "lua@revalation.co.uk" botspeed = "LightSpeed" botdescr = "Oblivion ver:1.00 By Matt" botinfostring = "$MyINFO $ALL "..Bot.." "..botdescr.."$ $"..botspeed..strchar( 1 ).."$"..botemail.."$$" -- Don't alter/change this line or clients will crash on login SetToWho = { [0] = 1, -- Masters [1] = 1, -- Operators [2] = 1, -- Vips [3] = 1, -- Regs } function Main(user) frmHub:RegBot(Bot) SetTimer( 60 * Min ) StartTimer() LoadFile(MessageFile) SendToAll("Oblivion By Matt Has Be Started type !butlerhelp for Butler Help") end function OnTimer() SendToAll(Bot,"This Hub Runs Oblivion Made By Matt© Type !ohelp for Butler Help") end function DataArrival( user, data ) if (strsub(data, 1, 1) == "<" ) then data=strsub(data,1,strlen(data)-1) local _,_,cmd=strfind(data, "%b<>%s+(%S+)") --*************Start OF Kicker************************** if cmd == "!kick" then if not user.bOperator then user:SendData(Bot,"Oi You are not a op "..user.sName.." wat do u think ure doing !") return 1 else local s,e,nick,reason = strfind(data, "%b<>%s+%S+%s+(%S+)%s*(.*)") if nick == nil then user:SendData(Bot,"Syntax: !kick [reason] ") return 1 end local victim = GetItemByName(nick) if not victim then user:SendData(Bot, "nick ( "..nick.." ) is not online or wrong nick ") return 1 end if reason==nil or reason == "" then reason = "reason not given" end SendToAll(Bot, victim.sName.." is kicked by "..user.sName.." Because: "..reason) victim:SendPM(Bot, "You have been kicked by "..user.sName.." Because: "..reason) victim:TempBan() return 1 end; elseif cmd == "!ban" then if not user.bOperator then user:SendData(Bot,"Oi You are not a op "..user.sName.." wat do u think ure doing !") return 1 else local s,e,nick,reason = strfind(data, "%b<>%s+%S+%s+(%S+)%s*(.*)") if nick == nil then user:SendData(Bot,"Syntax: !ban [reason] ") return 1 end local banee = GetItemByName(nick) if not banee then user:SendData(Bot, "nick ( "..nick.." ) is not online or wrong nick ") return 1 end if reason==nil or reason == "" then reason = "reason not given" end SendToAll(Bot, banee.sName.." is Banned by "..user.sName.." Because: "..reason) banee:SendPM(Bot, "You have been Banned by "..user.sName.." Because: "..reason) banee:Ban() return 1 end elseif cmd == "!nickban" then if not user.bOperator then user:SendData(Bot,"Oi You are not a op "..user.sName.." wat do u think ure doing !") return 1 else local s,e,nick,reason = strfind(data, "%b<>%s+%S+%s+(%S+)%s*(.*)") if nick == nil then user:SendData(Bot,"Syntax: !nickban [reason] ") return 1 end local banee = GetItemByName(nick) SendToAll(Bot, banee.sName.." is Banned by "..user.sName.." Because: "..reason) banee:NickBan() return 1 end elseif cmd == "!warn" then if not user.bOperator then user:SendData(Bot,"Oi You are not a op "..user.sName.." wat do u think ure doing !") return 1 else local s,e,nick,reason = strfind(data, "%b<>%s+%S+%s+(%S+)%s*(.*)") if nick == nil then user:SendData(Bot,"Syntax: !warn [reason] ") return 1 end local banee = GetItemByName(nick) if not banee then user:SendData(Bot, "nick ( "..nick.." ) is not online or wrong nick ") return 1 end if reason==nil or reason == "" then reason = "reason not given" end SendToAll(Bot, banee.sName.." is Warned by "..user.sName.." Because: "..reason) banee:SendPM(Bot, "You have been Warned by "..user.sName.." Because: "..reason.." Dont Do It Again And Sort It Out") return 1 end elseif cmd == "!drop" then if not user.bOperator then user:SendData(Bot,"Oi You are not a op "..user.sName.." wat do u think ure doing !") return 1 else local s,e,nick,reason = strfind(data, "%b<>%s+%S+%s+(%S+)%s*(.*)") if nick == nil then user:SendData(Bot,"Syntax: !ban [reason] ") return 1 end local banee = GetItemByName(nick) if not banee then user:SendData(Bot, "nick ( "..nick.." ) is not online or wrong nick ") return 1 end if reason==nil or reason == "" then reason = "reason not given" end banee:SendPM(Bot, "You have been Disconnected by "..user.sName.." Because: "..reason) banee:Disconnect() banee:TempBan() return 1 end return 1 end elseif cmd == "!topic" then if user.iProfile == 0 then local s,e,cmd,Topic = strfind(data,"%b<>%s+(%S+)%s+(.+)") frmHub:SetHubName(HubName.." - "..Topic) SendToAll("$HubName "..HubName.." - "..Topic) SendToAll(Bot, user.sName.." Changed the topic to: "..Topic) elseif cmd == "!deltopic" then frmHub:SetHubName(HubName) SendToAll("$HubName "..HubName) end elseif (cmd=="!addreguser") then if (user.bOperator) then local s,e,nick,pass,level = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s+(%S+)") AddRegUser(nick, pass, level) SendToAll(Bot, "An Op just registered: "..nick) return 1 end elseif (PMSpy==1) then if (( strsub(data, 1, 4) == "$To:" )) then user=GetItemByName(dest) user:SendData("$Hello "..botname.."|") endPmToNick(HubOwner, Bot, data) end elseif (cmd=="!delreg") then if (user.bOperator) then s,e,cmd,str = strfind(data, "%b<>%s+(%S+)%s+(%S+)") DelRegUser(str) SendToAll(Bot, "An Op just unregistered: "..str) return 1 end --*****************************************butler commands start*************************** elseif (cmd == "!swelcome") then local s,e,cmd,args = strfind(data, "%b<>%s+(%S+)%s+(.+)") if args then if tMessages[user.sName] == nil then tMessages[user.sName] = { ["Welcome"] = args } else tMessages[user.sName]["Welcome"] = args end SaveFile(tMessages, "tMessages", MessageFile) user:SendData(Bot,"Welcome Message to User "..user.sName.." is set: "..args) return 1 else user:SendData(Bot,"*** No Welcome Message Typed!") return 1 end elseif (cmd == "!sgoodbye") then local s,e,cmd,args = strfind(data, "%b<>%s+(%S+)%s+(.+)") if args then if tMessages[user.sName] == nil then tMessages[user.sName] = { ["Goodbye"] = args } else tMessages[user.sName]["Goodbye"] = args end SaveFile(tMessages, "tMessages", MessageFile) user:SendData(Bot,"Goodbye Message to User "..user.sName.." is set: "..args) return 1 else user:SendData(Bot,"*** No Goodbye Message Typed!") return 1 end elseif (cmd == "!butlerclear") then if tMessages[user.sName] then tMessages[user.sName] = nil SaveFile(tMessages, "tMessages", MessageFile) user:SendData(Bot,"Your welcome/Goodbye messages are removed and set to deafult!") return 1 end elseif cmd == "!butlerhelp" then MessageHelp(user) elseif cmd == "!butlercredits" then credits(user) elseif (cmd == "!shomsgs") then if tMessages then local txt,vw,vg,count = "\r\n", "", "", 0 for i,v in tMessages do if i then count = count + 1 if v.Welcome == nil then vw = "None" else vw = v.Welcome end if v.Goodbye == nil then vg = "None" else vg = v.Goodbye end end txt = txt..""..count..". "..i.."\r\n\tWelcome: "..vw.."\r\n\tGoodbye: "..vg.."\r\n" end user:SendPM(Bot, txt) end end end function OpConnected(user) SendToAll(botinfostring) if SetToWho[user.iProfile]==1 then local doMessage = "" if tMessages[user.sName] and tMessages[user.sName]["Welcome"] then doMessage = tMessages[user.sName]["Welcome"] else doMessage = GetProfileName(user.iProfile).." "..user.sName.." Has Enterd The Hub" end SendToAll(Bot, doMessage) end end function OpDisconnected(user) if SetToWho[user.iProfile]==1 then local doMessage = "" if tMessages[user.sName] and tMessages[user.sName]["Goodbye"] then doMessage = GetProfileName(user.iProfile).." "..user.sName.." Has Left The Hub" else doMessage = tMessages[user.sName]["Goodbye"] end SendToAll(Bot, doMessage) end end function NewUserConnected(user) SendToAll(botinfostring) if SetToWho[user.iProfile]==1 then local doGetProfileName,doMessage = GetProfileName(user.iProfile) or "User", "" if tMessages[user.sName] and tMessages[user.sName]["Welcome"] then doMessage = tMessages[user.sName]["Welcome"] else doMessage = GetProfileName(user.iProfile).." "..user.sName.." Has Enterd The Hub" end SendToAll(Bot, doMessage) end if user.iProfile == -1 then user:SendData(Bot,"Welcome "..user.sName.." To "..frmHub:GetHubName().." have a good time!") end end function UserDisconnected(user) if SetToWho[user.iProfile]==1 then local doGetProfileName,doMessage = GetProfileName(user.iProfile) or "User", "" if tMessages[user.sName] and tMessages[user.sName]["Goodbye"] then doMessage = doGetProfileName.." "..user.sName.." Has Left The Hub" else doMessage = tMessages[user.sName]["Goodbye"] end SendToAll(Bot, doMessage) end end function Serialize(tTable, sTableName, hFile, sTab) assert(tTable, "tTable equals nil") assert(sTableName, "sTableName equals nil") assert(hFile, "hFile equals nil") assert(type(tTable) == "table", "tTable must be a table!") assert(type(sTableName) == "string", "sTableName must be a string!") sTab = sTab or "" write(hFile, sTab..sTableName.." = {\n" ) for key, value in tTable do local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key) if(type(value) == "table") then Serialize(value, sKey, hFile, sTab.."\t") else local sValue = (type(value) == "string") and format("%q",value) or tostring(value) write(hFile, sTab.."\t"..sKey.." = "..sValue) end write(hFile, ",\n") end write(hFile, sTab.."}") end function SaveFile(table , tablename, file) local hFile = openfile(file, "w") Serialize(table, tablename, hFile) closefile(hFile) end function LoadFile(file) assert(readfrom(file),file.." is not found.") dostring(read("*all")) readfrom() end function MessageHelp(user) local handle = openfile("butler/help.txt", "r") ReadTheFile(user,handle) end function credits(user) local handle = openfile("butler/credits.txt", "r") ReadTheFile(user,handle) end function ReadTheFile(user,handle) if (handle ~= nil) then local line = read(handle) Temptimerfile = "\r\n" while line do Temptimerfile = Temptimerfile.."\r\n"..line line = read(handle) end user:SendData(Bot, Temptimerfile) closefile(handle) end end --************************************ --**Bot By [TLG]Matt© Revalation Hub** --************************************