SHARE
TWEET

Untitled

a guest Oct 3rd, 2017 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --UniteamBot made by Tryton
  2. --27/07/2011
  3. ----------------------------------------------
  4. --Functions--
  5. --Auto op function
  6. --BadWords List
  7. --Poll function (for another mod)
  8. --Login gui
  9. ----------------------------------------------
  10. --To Do--
  11. --Speak if a player got decaped
  12.  
  13. ------------------------------------------------
  14. ------------------------------------------------
  15.  
  16.  
  17. serverip = "66.230.224.162"
  18. serverport = 20184
  19.  
  20. defaultuser = "UniteamBOT"
  21. defaultpass = "Uniteambottest"
  22.  
  23. OpList = {"Tryton", "name1", "name2", "name3", "name4",}--Enter the people who can be opped
  24. BadWords = {"nigger", "bitch", "asshole", "fag", "fuck",}--Enter all bad words you want
  25.  
  26. ------------------------------------------------------
  27. --Dont chnge this if u dont know what you are doing!--
  28. ------------------------------------------------------
  29.  
  30. dofile("scripts/BaseBot.lua")
  31.  
  32. function Say(text)
  33.     text = string.gsub(text, "#time", os.date("%X"))
  34.     Send("SAY " .. text)
  35. end
  36.  
  37. Connect(serverip,serverport)
  38. Login(user,pass)
  39. Say(".:UniteamBot Connected:.")
  40. Spec("")
  41.  
  42. PollNames = {}
  43. PollVotes = {}
  44. VoteNo = 0
  45. VoteYes = 0
  46. Voted = nil
  47.  
  48. --Mute and unmute players
  49. muteTimers = { }
  50. currTimer = 1
  51. function muteFor(name,time)
  52.     Send("mute " .. name)
  53.     muteTimers[currTimer] = timer()
  54.     muteTimers[currTimer].Interval = time*1000
  55.     muteTimers[currTimer].Enabled = true
  56.     muteTimers[currTimer].Tick:Add(
  57.         function()
  58.             Send("unmute " .. name)
  59.         end)
  60.     currTimer = currTimer + 1
  61. end
  62.  
  63. --Anti Ping-Out
  64. timer1 = timer()
  65. timer1.Interval = 5000
  66. timer1.Enabled = true
  67. timer1.Tick:Add(
  68.     function()
  69.         Send("PING")
  70.     end)
  71.  
  72. --Get Chat
  73. function LineChanged(Line)
  74.     if(Line:sub(0,3) == "SAY") then
  75.         A = Line:find(";")
  76.         B = Line:find(" ",A+1)
  77.         print("> " ..Line:sub(A+1))
  78.         if(B ~= nil) then
  79.             Chat = Line:sub(B+1)
  80.            MsgOwnerEnd = Line:find("> ")          
  81.         end
  82.         if MsgOwnerEnd ~= nil then
  83.             MsgOwner = Line:sub(A+8, MsgOwnerEnd-4)
  84.         --Op a Player
  85.             if Chat == "!op" then
  86.                 for n=0, #OpList do
  87.                     if OpList[n] == MsgOwner then
  88.                         Op = 1
  89.                     end
  90.                 end
  91.                 if Op == 1 then
  92.                     Send("op " ..MsgOwner)
  93.                     Say("You are now opped " ..MsgOwner.."!")
  94.                     Op = 0
  95.                 elseif Op == nil then
  96.                     Say("Dont try to get opped if you arent allowed "..MsgOwner.."! <muted for 60 seconds>")
  97.                     muteFor(MsgOwner, 30)
  98.                     Op = nil
  99.                 end
  100.             end
  101.         --Find badwords
  102.             for w=1, #BadWords do
  103.                 Word = string.lower(BadWords[w])
  104.                 if Chat:find(Word) ~= nil then
  105.                     Say("Don't say such bad words! <muted for 60 seconds>")
  106.                     muteFor(MsgOwner, 60)
  107.                 end
  108.             end
  109.         --Vote system
  110.             --Mod
  111.             IfModPoll = Chat:sub(0, 5)
  112.             if IfModPoll == "!Mod " and Poll == nil and MsgOwner ~= user or IfModPoll == "!mod " and Poll == nil and MsgOwner ~= user then
  113.                 PollObject = Chat:sub(6)
  114.                 Poll = "set mod"
  115.                 PollNames[0] = MsgOwner
  116.                 PollVotes[0] = "yes"
  117.                 PollStartTime = os.time(sec)
  118.                 Say(MsgOwner.." Started a poll to change the mod to "..PollObject.."!")
  119.                 Say("Type !yes or !no to vote. The poll will end in 40 seconds")
  120.             elseif IfModPoll == "!Mod " and  Poll ~= nil and MsgOwner ~= user or IfModPoll == "!mod " and  Poll ~= nil and MsgOwner ~= user then
  121.                 Say("There can be only one active poll")
  122.             end
  123.             --Ban
  124.             if IfModPoll == "!Ban " and Poll == nil and MsgOwner ~= user or IfModPoll == "!ban " and Poll == nil and MsgOwner ~= user then
  125.                 PollObject = Chat:sub(6)
  126.                 Poll = "ban"
  127.                 PollNames[0] = MsgOwner
  128.                 PollVotes[0] = "yes"
  129.                 PollStartTime = os.time(sec)
  130.                 Say(MsgOwner.." Started a poll to ban the player "..PollObject.."!")
  131.                 Say("Type !yes or !no to vote. The poll will end in 40 seconds")
  132.             elseif IfModPoll == "!Ban " and  Poll ~= nil and MsgOwner ~= user or IfModPoll == "!ban " and  Poll ~= nil and MsgOwner ~= user then
  133.                 Say("There can be only one active poll")
  134.             end
  135.             --Kick
  136.             if IfModPoll == "!Kick" and Poll == nil and MsgOwner ~= user or IfModPoll == "!kick" and Poll == nil and MsgOwner ~= user then
  137.                 PollObject = Chat:sub(6)
  138.                 Poll = "kick"
  139.                 PollNames[0] = MsgOwner
  140.                 PollVotes[0] = "yes"
  141.                 PollStartTime = os.time(sec)
  142.                 Say(MsgOwner.." Started a poll to kick the player "..PollObject.."!")
  143.                 Say("Type !yes or !no to vote. The poll will end in 40 seconds")
  144.             elseif IfModPoll == "!Kick" and  Poll ~= nil and MsgOwner ~= user or IfModPoll == "!kick" and  Poll ~= nil and MsgOwner ~= user then
  145.                 Say("There can be only one active poll")
  146.             end
  147.             if  Poll ~= nil and Chat == "!yes" and MsgOwner ~= user or  Poll ~= nil and Chat == "!Yes" and MsgOwner ~= user then
  148.                 for Num=0, #PollNames do
  149.                     if PollNames[Num] == MsgOwner then
  150.                         VoteNumber = Num
  151.                     end
  152.                 end
  153.                 if VoteNumber == nil then
  154.                     Num = #PollNames+1
  155.                     PollNames[Num] = MsgOwner
  156.                     PollVotes[Num] = "yes"
  157.                     VoteNumber = nil
  158.                 else
  159.                     Say("You can vote only once")
  160.                     VoteNumber = nil
  161.                 end
  162.             elseif Poll ~= nil and Chat == "!no" and MsgOwner ~= user or Poll ~= nil and Chat == "!No" and MsgOwner ~= user then
  163.                 for Num=0, #PollNames do
  164.                     if PollNames[Num] == MsgOwner then
  165.                         VoteNumber = Num
  166.                     end
  167.                 end
  168.                 if VoteNumber == nil then
  169.                     Num = #PollNames+1
  170.                     PollNames[Num] = MsgOwner
  171.                     PollVotes[Num] = "no"
  172.                     VoteNumber = nil
  173.                 else
  174.                     Say("You can vote only once")
  175.                     VoteNumber = nil
  176.                 end
  177.             end
  178.         end
  179.     end
  180.     if Line:sub(0,6) == "BOUT 0" then
  181.         Clients = 0
  182.         if Line:sub(0,4) == "BOUT" then
  183.             Bouts = Line:sub(5, 6)-1
  184.         end
  185.     end
  186. end
  187.  
  188. --FAQ commands
  189.  
  190. --Get poll end
  191. Ti.Tick:Add(function()
  192.     if Poll ~= nil then
  193.         if PollStartTime+40 <= os.time(sec) or Clients/2-1 > #PollVotes then
  194.             for v=0, #PollVotes do
  195.                 if PollVotes[v] == "yes" then
  196.                     VoteYes=VoteYes+1
  197.                 elseif PollVotes[v] == "no" then
  198.                     VoteNo=VoteNo+1
  199.                 end
  200.             end
  201.             if VoteYes <= VoteNo then
  202.                 Say("Vote: Failed("..VoteNo..":"..VoteYes..").")
  203.             else
  204.                 Say("Vote: Passed("..VoteYes..":"..VoteNo..").")
  205.                 Send(Poll.." "..PollObject)
  206.             end
  207.             Poll = nil
  208.             PollNames = {}
  209.             PollVotes = {}
  210.             VoteYes = 0
  211.             VoteNo = 0
  212.         end
  213.     end
  214. end)
  215.  
  216. function setServer()
  217.     serverSettings = io.open("Scripts/serversettings.txt")
  218.     if(serverSettings == nil) then
  219.         print("Failed to load serversettings.txt")
  220.     else
  221.         line = serverSettings:read("*l")
  222.         i=1
  223.         while(line ~= nil) do
  224.             Send("" .. line)
  225.             print("Set \"" .. line .. "\" at line " .. i)
  226.             line = serverSettings:read("*l")
  227.             i = i + 1
  228.         end
  229.     end
  230. end
  231.  
  232. --Open the Gui
  233. --Main Gui
  234. form1 = form()
  235. form1.Height = 125
  236. form1.Width = 250
  237. button1 = button()
  238. button1.Text = "Disconnect"
  239. button1.Dock = dockStyle.Bottom
  240. button1.Click:Add(function() Disconnect(); form1:Close() end)
  241. inputBox1 = textBox()
  242. inputBox1.Text = "hi"
  243. inputBox1.Dock = dockStyle.Bottom
  244. button2 = button()
  245. button2.Text = "Say"
  246. button2.Dock = dockStyle.Bottom
  247. button2.Click:Add(function() Say(inputBox1.Text) end)
  248. button3 = button()
  249. button3.Text = "Send"
  250. button3.Dock = dockStyle.Bottom
  251. button3.Click:Add(function() Send(inputBox1.Text) end)
  252. button4 = button()
  253. form1.Controls:Add(inputBox1)
  254. form1.Controls:Add(button2)
  255. form1.Controls:Add(button3)
  256. form1.Controls:Add(button1)
  257.  
  258. --Login Gui
  259. LoginForm = form()
  260. LoginForm.Text = "Login"
  261. LoginForm.Height = 105
  262. LoginForm.Width = 250
  263. Username = textBox()
  264. Username.Text = defaultuser
  265. Username.Dock = dockStyle.Bottom
  266. Passwd = textBox()
  267. Passwd.Text = defaultpass
  268. Passwd.PasswordChar = "*"
  269. Passwd.Dock = dockStyle.Bottom
  270. LoginButton = button()
  271. LoginButton.Text = "Login"
  272. LoginButton.Dock = dockStyle.Bottom
  273. LoginButton.Click:Add(function() user=Username.Text; pass=Passwd.Text Connect(serverip,serverport); Login(user,pass); Spec(); LoginForm:Close(); form1.Text = user.."Server"; form1:Show(); setServer() end)
  274. LoginForm.Controls:Add(Username)
  275. LoginForm.Controls:Add(Passwd)
  276. LoginForm.Controls:Add(LoginButton)
  277. LoginForm:Show()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top