cortesjoren

admin in sword simulator :D

Dec 19th, 2018
633
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.23 KB | None | 0 0
  1. --[[
  2. WARNING: The commands('cmds', 'admin' and 'unadmin' will make you chat)
  3. To kill silently type '/e kill' (it will kill everybody)[/align]
  4. [align=center]You cant kill the people that have force field on
  5. --------------------------
  6. Prefix --> ';'
  7. [0]CMDS:
  8. [1]kill (me/plr/others/all)
  9. [2]admin (all/plr)
  10. [3]unadmin (all/plr)
  11. [4]af (autofarm)
  12. [5]saf (stop autofarm)
  13. [6]cmds (chats the cmds list)
  14. --------------------------
  15. If you found any bug please go to this thread and let me know it!
  16. https://v3rmillion.net/showthread.php?tid=690888
  17. --]]
  18. local isAdmin = {[game.Players.LocalPlayer.Name] = true, ["FRIEND1"] = true, ["FRIEND2"] = true} --Admins
  19. local lplr = game.Players.LocalPlayer.Name
  20. local au = false
  21. Owner = game:GetService("Players").LocalPlayer
  22. game:GetService("StarterGui"):SetCore("SendNotification", {
  23. Title = "Sword Simulator Admin";
  24. Text = "Enjoy the script while it lasts!";})
  25.  
  26. function GetPlayer(String) -- Credits to Timeless/xFunnieuss for the get player by string function
  27. local Found = {}
  28. for i,v in pairs(game:GetService("Players"):GetPlayers()) do
  29. if v.Name:lower():sub(1, #String) == String:lower() then
  30. table.insert(Found,v)
  31. end
  32. end
  33. return Found
  34. end
  35.  
  36. local function AF()
  37. au = true
  38. game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  39. while au do
  40. game.Workspace[lplr].sword.Handle.up.RemoteEvent:FireServer() wait(.1)
  41. if game.Players[lplr].Backpack["sword"] then
  42. game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  43. end
  44. end
  45. end
  46.  
  47. local function KA()
  48. game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  49. for i,v in ipairs(game.Players:GetPlayers())do
  50. game.Workspace[lplr].sword.Handle.dmg.RemoteEvent:FireServer(workspace[v.Name].Humanoid, 9999999999999999999999)
  51. end end
  52.  
  53. local function KO()
  54. game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  55. for i,v in ipairs(game.Players:GetPlayers())do
  56. if v.Name ~= game.Players.LocalPlayer.Name then
  57. game.Workspace[lplr].sword.Handle.dmg.RemoteEvent:FireServer(workspace[v.Name].Humanoid, 9999999999999999999999)
  58. end end
  59. end
  60.  
  61. print'Loaded'
  62. function onChatted(message, player)
  63. if message:sub(1, 6) == ";kill " and isAdmin[player.Name] then
  64. if string.sub(message, 7) == "all" then
  65. KA()
  66. elseif string.sub(message, 7) == "me" then
  67. game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  68. ggame.Workspace[lplr].sword.Handle.dmg.RemoteEvent:FireServer(workspace[v.Name].Humanoid, 9999999999999999999999)
  69. elseif string.sub(message, 7) == "others" then
  70. if player.Name == Owner.Name then
  71. KO()
  72. else
  73. game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  74. for i,v in ipairs(game.Players:GetPlayers())do
  75. if v.Name ~= player.Name then
  76. game.Workspace[lplr].sword.Handle.dmg.RemoteEvent:FireServer(workspace[v.Name].Humanoid, 9999999999999999999999)
  77. end end
  78. end
  79. else
  80. game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  81. for i,v in pairs(GetPlayer(string.sub(message, 7)))do
  82. local plr = v.Name
  83.  
  84. for i,p in ipairs(game.Players:GetPlayers())do
  85. if p.Name ~= game.Players.LocalPlayer.Name then
  86. game.Workspace[lplr].sword.Handle.dmg.RemoteEvent:FireServer(workspace[v.Name].Humanoid, 9999999999999999999999)
  87. end end end
  88. end
  89. end
  90.  
  91. if message:sub(1, 7) == "/e kill" and isAdmin[player.Name] then
  92. KA()
  93. end
  94.  
  95. if message:sub(1, 6) == ";cmds" then
  96. if player.Name == Owner.Name then
  97. wait(0.2)
  98. game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System]CMDS: [1]kill(me/plr/others/all), [2]admin(all/plr), [3]unadmin(all/plr), [4]af(autofarm), [5]saf(stop autofarm), [6]cmds", "All")
  99. elseif isAdmin[player.Name] and player.Name ~= Owner.Name then
  100. wait(0.2)
  101. game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System]CMDS: [1]kill(me/plr/others/all), [2]admin(all/plr), [3]unadmin(all/plr), [4]cmds", "All")
  102. end
  103. end
  104.  
  105. if message:sub(1, 7) == ";admin " and isAdmin[player.Name] then
  106. if string.sub(message, 8) == "all" and isAdmin[Owner.Name] then
  107. if isAdmin[Owner.Name] then
  108. for i,plrs in ipairs(game:GetService('Players'):GetChildren())do
  109. isAdmin[plrs.Name] = {true}
  110. end
  111. wait(0.2)
  112. game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System]Everyone is now Admin!", "All")
  113. end
  114. else
  115. for i,v in pairs(GetPlayer(string.sub(message, 8)))do
  116. local plr = v.Name
  117. if isAdmin[plr] then
  118. game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System]"..plr.." is already Admin!", "All")
  119. else
  120. isAdmin[plr] = {true}
  121. wait(0.2)
  122. game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System]"..plr.." is now Admin!", "All")
  123. end
  124. end
  125. end
  126. end
  127.  
  128. if message:sub(1, 9) == ";unadmin " and isAdmin[player.Name] then
  129. if string.sub(message, 10) == "all" then
  130. if isAdmin[Owner.Name] then
  131. for i,plrs in ipairs(game:GetService('Players'):GetPlayers())do
  132. isAdmin[plrs.Name] = false
  133. isAdmin[Owner.Name] = true
  134. end
  135. wait(0.2)
  136. game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System]Everyone is no longer Admin!", "All")
  137. end
  138. else
  139. for i,v in pairs(GetPlayer(string.sub(message, 10)))do
  140. local plr = v.Name
  141. if plr == Owner.Name then
  142. game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System]Error, this player is the Owner!", "All")
  143. else
  144. isAdmin[plr] = false
  145. wait(0.2)
  146. game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System]"..plr.." is no longer Admin!", "All")
  147. end
  148. end
  149. end
  150. end
  151.  
  152. if message:sub(1, 3) == ";af" and player.Name == Owner.Name then
  153. AF()
  154. end
  155.  
  156. if message:sub(1, 4) == ";saf" and player.Name == Owner.Name then
  157. au = false
  158. end
  159. end
  160.  
  161. Players = game:GetService("Players")
  162. for i, player in pairs(Players:GetPlayers()) do
  163. player.Chatted:connect(function(message) onChatted(message, player) end)
  164. end
  165.  
  166. --Check if someone joined
  167. game.Players.PlayerAdded:connect(function(player)
  168. player.Chatted:connect(function(message) onChatted(message, player) end)
  169. end)
Add Comment
Please, Sign In to add comment