War

Untitled

War
Mar 16th, 2017
665
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.89 KB | None | 0 0
  1. game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg)
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10. local function GetPlr(plr, str)
  11. local plrz = {} str = str:lower()
  12. if str == "all" then plrz = game.Players:children()
  13. elseif str == "others" then for i, v in pairs(game.Players:children()) do if v ~= plr then table.insert(plrz, v) end end
  14. else
  15. local sn = {1} local en = {}
  16. for i = 1, #str do if str:sub(i,i) == "," then table.insert(sn, i+1) table.insert(en,i-1) end end
  17. for x = 1, #sn do
  18. if (sn[x] and en[x] and str:sub(sn[x],en[x]) == "me") or (sn[x] and str:sub(sn[x]) == "me") then table.insert(plrz, plr)
  19. elseif (sn[x] and en[x] and str:sub(sn[x],en[x]) == "random") or (sn[x] and str:sub(sn[x]) == "random") then table.insert(plrz, game.Players:children()[math.random(#game.Players:children())])
  20. elseif (sn[x] and en[x] and str:sub(sn[x],en[x]) == "admins") or (sn[x] and str:sub(sn[x]) == "admins") then if ChkAdmin(plr.Name, true) then for i, v in pairs(game.Players:children()) do if ChkAdmin(v.Name, false) then table.insert(plrz, v) end end end
  21. elseif (sn[x] and en[x] and str:sub(sn[x],en[x]) == "nonadmins") or (sn[x] and str:sub(sn[x]) == "nonadmins") then for i, v in pairs(game.Players:children()) do if not ChkAdmin(v.Name, false) then table.insert(plrz, v) end end
  22. elseif (sn[x] and en[x] and str:sub(sn[x],en[x]):sub(1,4) == "team") then
  23. if game:findFirstChild("Teams") then for a, v in pairs(game.Teams:children()) do if v:IsA("Team") and str:sub(sn[x],en[x]):sub(6) ~= "" and v.Name:lower():find(str:sub(sn[x],en[x]):sub(6)) == 1 then
  24. for q, p in pairs(game.Players:children()) do if p.TeamColor == v.TeamColor then table.insert(plrz, p) end end break
  25. end end end
  26. elseif (sn[x] and str:sub(sn[x]):sub(1,4):lower() == "team") then
  27. if game:findFirstChild("Teams") then for a, v in pairs(game.Teams:children()) do if v:IsA("Team") and str:sub(sn[x],en[x]):sub(6) ~= "" and v.Name:lower():find(str:sub(sn[x]):sub(6)) == 1 then
  28. for q, p in pairs(game.Players:children()) do if p.TeamColor == v.TeamColor then table.insert(plrz, p) end end break
  29. end end end
  30. else
  31. for a, plyr in pairs(game.Players:children()) do
  32. if (sn[x] and en[x] and str:sub(sn[x],en[x]) ~= "" and plyr.Name:lower():find(str:sub(sn[x],en[x])) == 1) or (sn[x] and str:sub(sn[x]) ~= "" and plyr.Name:lower():find(str:sub(sn[x])) == 1) or (str ~= "" and plyr.Name:lower():find(str) == 1) then
  33. table.insert(plrz, plyr) break
  34. end
  35. end
  36. end
  37. end
  38. end
  39. return plrz
  40. end
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. if msg:lower():sub(1,5) == "give " and plr:GetRankInGroup(2560312) >= 4 then
  50. local chk1 = msg:lower():sub(6):find(" ") + 5
  51. local plrz = GetPlr(plr, msg:lower():sub(6,chk1-1))
  52. for i, v in pairs(plrz) do
  53. if v and v:findFirstChild("Backpack") and game:findFirstChild("ServerStorage") then
  54. for a, tool in pairs(game.ServerStorage:children()) do
  55. if tool:IsA("Tool") or tool:IsA("HopperBin") then
  56. if tool.Name:lower():find(msg:lower():sub(chk1+1)) == 1 then
  57. tool:Clone().Parent = v.Backpack
  58.  
  59. print(plr.Name)
  60. print(tool.Name)
  61. local S = game.Workspace.Manage.SurfaceGui
  62. local Ok = Color3.new(0/255,184/255,6/255)
  63. local OkS = Color3.new(255/255,255/255,255/255)
  64. local NoS = Color3.new(184/255,0/255,0/255)
  65. local No = Color3.new(184/255,0/255,0/255)
  66.  
  67. print(tool.Name:lower():sub(5))
  68. local N = tool.Name:lower():sub(6)
  69.  
  70. print(tool.Name:reverse():lower():sub(7) )
  71.  
  72. if(tool.Name:reverse():lower():sub(7) == "us") then
  73. R = N.."S"
  74. X = S.Rooms:findFirstChild(R)
  75. print(R)
  76. else
  77. print(R)
  78. R = N
  79. X = S.Rooms:findFirstChild(R)
  80. end
  81.  
  82. local children = workspace.Manage.SurfaceGui.Rooms:GetChildren()
  83. for i = 1, #children do
  84.     repeat wait() until children[i]
  85.     if(children[i].Name == R) then
  86.     T = children[i].Taken
  87.     if(T.Value == 0) then
  88.     X.BackgroundColor3 = No
  89.     X.N1.Text = v.Name
  90.     T.Value = 1
  91.     elseif (T.Value == 1) then
  92.     end
  93.  
  94.    
  95. end
  96. end
  97.  
  98.  
  99.  
  100. print(tostring(N.."S"))
  101.  
  102.  
  103. print(N)
  104.  
  105.  
  106.  
  107.  
  108. end
  109. end
  110. end
  111. end
  112. end
  113. end
  114. end)
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131. end)
Advertisement
Add Comment
Please, Sign In to add comment