Advertisement
Guest User

Untitled

a guest
Nov 28th, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.73 KB | None | 0 0
  1. local Term = Workspace.Terminal.Term
  2. local CNC = BrickColor.new("Really blue")
  3. local RC = BrickColor.new("Really red")
  4. local T = 120
  5. local CT = 12
  6. local CN = 0
  7. local R = 0
  8. local CNOwned = true
  9. local tplrs = {}
  10. function Check(x)
  11. local added = false
  12.     for i = 1, #tplrs do
  13.         if tplrs[i] == x then
  14.             added = true
  15.         end
  16.     end
  17.     return added
  18. end
  19. Term.Touched:connect(function(x)
  20.     if x.Parent:FindFirstChild("Humanoid") then
  21.         if x.Parent.Humanoid.Health < 1 then return end
  22.         local plr = Game.Players[x.Parent.Name]
  23.         if not Check(plr) then table.insert(tplrs, #tplrs+1, plr) end
  24.     end
  25. end)
  26. Term.TouchEnded:connect(function(x)
  27.     if x.Parent:FindFirstChild("Humanoid") then
  28.         local plr = Game.Players[x.Parent.Name]
  29.         for i = 1, #tplrs do
  30.             if Workspace:FindFirstChild(tplrs[i].Name) then
  31.                 if Workspace[tplrs[i].Name]:FindFirstChild("Torso") then
  32.                     local Mag = (Term.Position - Workspace[tplrs[i].Name].Torso.Position).magnitude
  33.                     if tplrs[i] == plr or not Game.Players:FindFirstChild(tplrs[i].Name) or not Mag < 15 then
  34.                         table.remove(tplrs, i)
  35.                     end
  36.                 end
  37.             end
  38.         end
  39.     end
  40. end)
  41. while wait(1) do
  42.     CN,R = 0,0
  43.     for i = 1, #tplrs do
  44.         if tplrs[i].TeamColor == CNC then
  45.             CN = CN + 1
  46.         elseif tplrs[i].TeamColor == RC then
  47.             R = R + 1
  48.         end
  49.     end
  50.     if CN > 0 and R > 0 then
  51.         else
  52.         if CN > 0 and CT <= 120 then
  53.             CT = CT + 1
  54.         elseif R > 0 and CT > 0 then
  55.             CT = CT - 1
  56.         end
  57.         if CT == 120 then
  58.             CNOwned = true
  59.         elseif CT == 0 then
  60.             CNOwned = false
  61.         end
  62.     end
  63.     if CNOwned and T < 1200 then
  64.         T = T + 1
  65.     elseif not CNOwned and T > 0 then
  66.         T = T - 1
  67.     end
  68.     if CT > 120 then CT = 120 end; if CT < 0 then CT = 0 end; if T < 0 then T = 0 end; if T > 1200 then T = 1200 end
  69.     print(T, CT)
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement