Advertisement
NikePro2004

Untitled

May 29th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.77 KB | None | 0 0
  1. local Script = script.Script
  2. local LocalScript = script.LocalScript
  3.  
  4. local Screen = Instance.new("ScreenGui")
  5. local List = Instance.new("Frame")
  6. List.Name = "List"
  7. List.BackgroundTransparency = 1
  8. List.Size = UDim2.new(0,120,0,14)
  9. List.Position = UDim2.new(0,0,1,0)
  10. List.Parent = Screen
  11. local Title = Instance.new("TextLabel")
  12. Title.Name = "Title"
  13. Title.Text = "Scripts:"
  14. Title.BackgroundColor3 = Color3.new(0,0,0)
  15. Title.BorderColor3 = Color3.new(0,0,0)
  16. Title.TextColor3 = Color3.new(1,1,1)
  17. Title.Size = UDim2.new(1,0,1,0)
  18. Title.Parent = List
  19. local Label = Instance.new("TextLabel")
  20. Label.BackgroundColor3 = Color3.new(1,1,1)
  21. Label.BorderColor3 = Color3.new(1,1,1)
  22. Label.TextColor3 = Color3.new(0,0,0)
  23. Label.Size = UDim2.new(1,0,1,0)
  24.  
  25. function Message(player,time,msg)
  26. local desk = desk[player]
  27. local message = desk.message
  28. desk.last_msg = tick()
  29. message.Text = msg
  30. message.Parent = player
  31. if time >= 0 then
  32. wait(time)
  33. if tick() + 0.05 - desk.last_msg >= time then
  34. message:Remove()
  35. end
  36. end
  37. end
  38.  
  39. function GetLines(source)
  40. local lines = {}
  41. for line in source:gmatch("[^\r\n]+") do
  42. table.insert(lines,line)
  43. end
  44. return lines
  45. end
  46.  
  47. BannedFolk = {}
  48. desk = {}
  49. topics = {
  50. Main = {
  51. ["create"]=[["create/(name)/local" Creates a new script named (name). Adding "/local" after creates a LocalScript instead.]];
  52. ["edit"]=[["edit/(name)" Enters edit mode with (name). Anything chatted while in edit mode is added to the script's source.]];
  53. ["run"]=[["run/(name)" Puts (name) in the workspace so that it runs.]];
  54. ["stop"]=[["stop/(name)" Removes (name) from the workspace.]];
  55. ["remove"]=[["remove/(name)" Deletes (name) from your list of scripts.]];
  56. ["help"]=[["help/(command)" Displays help for (command).]];
  57. };
  58. Edit = {
  59. ["append"]=[["append/(text)" Adds (text) to the script's source.]];
  60. ["insert"]=[["insert/(line)/(text)" Inserts (text) at the (line)th line.]];
  61. ["replace"]=[["replace/(line)/(text)" Replaces the (line)th line with (text).]];
  62. ["remove"]=[["remove/(line)" Removes the (line)th line.]];
  63. ["recall"]=[["recall/(line)" Displays the (line)th line.]];
  64. ["clear"]=[["clear/" Clears the script's source.]];
  65. ["exit"]=[["exit/" Exits edit mode.]];
  66. ["help"]=[["help/(command)" Displays help for (command).]];
  67. };
  68. }
  69. command = {
  70. Main = {
  71. ["create"] = function(player,name,type)
  72. if not name or name:match("%W") then Message(player,5,"ERROR: Invalid argument") return end
  73. local desk = desk[player]
  74. if not desk.scripts[name] then
  75. local script = (type == "local" and LocalScript or Script):Clone()
  76. script.Name = name
  77. local Screen = desk.screen
  78. local Label = Label:Clone()
  79. Label.Name = name
  80. Label.Text = name
  81. Label.Parent = Screen.List
  82. table.insert(desk.list,Label)
  83. desk.scripts[name] = {
  84. script = script;
  85. name = name;
  86. source = script.DSource;
  87. display = Label;
  88. running = false;
  89. }
  90. UpdateList(desk.list,Screen.List)
  91. Message(player,1,"Created " .. script.className .. " ("..name..")")
  92. else
  93. Message(player,5,"ERROR: Script ("..name..") already exists")
  94. end
  95. end;
  96. ["edit"] = function(player,name)
  97. if not name or name:match("%W") then Message(player,5,"ERROR: Invalid argument") return end
  98. local desk = desk[player]
  99. local set = desk.scripts[name]
  100. if set then
  101. desk.editing = set
  102. desk.mode = "Edit"
  103. SwitchScreen(desk.screen,desk.mode)
  104. set.display.BackgroundColor3 = Color3.new(1,0.8,0)
  105. Message(player,1,"Editing ("..name..")")
  106. else
  107. Message(player,5,"ERROR: Script ("..name..") does not exist")
  108. end
  109. end;
  110. ["run"] = function(player,name)
  111. if not name or name:match("%W") then Message(player,5,"ERROR: Invalid argument") return end
  112. local set = desk[player].scripts[name]
  113. if set then
  114. local script = set.script
  115. set.source.Parent = script
  116. set.script.Name = name
  117. set.running = true
  118. script.Parent = nil
  119. script.Parent = script.className == "LocalScript" and player.Backpack or workspace
  120. set.display.BackgroundColor3 = Color3.new(0,0.8,0)
  121. Message(player,1,"Running ("..name..")")
  122. else
  123. Message(player,5,"ERROR: Script ("..name..") does not exist")
  124. end
  125. end;
  126. ["stop"] = function(player,name)
  127. if not name or name:match("%W") then Message(player,5,"ERROR: Invalid argument") return end
  128. local set = desk[player].scripts[name]
  129. if set then
  130. set.script.Parent = nil
  131. set.running = false
  132. set.display.BackgroundColor3 = Color3.new(1,1,1)
  133. Message(player,1,"Stopped ("..name..")")
  134. else
  135. Message(player,5,"ERROR: Script ("..name..") does not exist")
  136. end
  137. end;
  138. ["remove"] = function(player,name)
  139. if not name or name:match("%W") then Message(player,5,"ERROR: Invalid argument") return end
  140. local desk = desk[player]
  141. local set = desk.scripts[name]
  142. if set then
  143. set.script:Remove()
  144. for i,v in pairs(desk.list) do
  145. if v.Name == name then
  146. v:Remove()
  147. table.remove(desk.list,i)
  148. break
  149. end
  150. end
  151. desk.scripts[name] = nil
  152. UpdateList(desk.list,desk.screen.List)
  153. Message(player,1,"Removed ("..name..")")
  154. else
  155. Message(player,5,"ERROR: Script ("..name..") does not exist")
  156. end
  157. end;
  158. ["help"] = function(player,topic)
  159. local topic = topics["Main"][topic]
  160. if topic then
  161. Message(player,-1,topic)
  162. else
  163. Message(player,-1,[[Type "help/(command)" to learn about a command.]])
  164. end
  165. end,
  166. };
  167. Edit = {
  168. ["append"] = function(player,text)
  169. local set = desk[player].editing
  170. local source = set.source
  171. source.Value = source.Value .. text .. "\n"
  172. Message(player,1,"Appended text")
  173. end;
  174. ["insert"] = function(player,line,text)
  175. line = tonumber(line)
  176. if not line then Message(player,5,"ERROR: Invalid argument") return end
  177. local set = desk[player].editing
  178. local source = set.source
  179. local lines = GetLines(source.Value)
  180. if #lines > 0 then
  181. line = line > #lines and #lines+1 or line < 1 and 1 or line
  182. table.insert(lines,line,text)
  183. source.Value = table.concat(lines,"\n") .. "\n"
  184. Message(player,1,"Inserted to line " .. line)
  185. else
  186. Message(player,5,"ERROR: Script is empty")
  187. end
  188. end;
  189. ["replace"] = function(player,line,text)
  190. line = tonumber(line)
  191. if not line then Message(player,5,"ERROR: Invalid argument") return end
  192. local set = desk[player].editing
  193. local source = set.source
  194. local lines = GetLines(source.Value)
  195. if #lines > 0 then
  196. line = line > #lines and #lines or line < 1 and 1 or line
  197. lines[line] = text
  198. source.Value = table.concat(lines,"\n") .. "\n"
  199. Message(player,1,"Replaced line " .. line)
  200. else
  201. Message(player,5,"ERROR: Script is empty")
  202. end
  203. end;
  204. ["remove"] = function(player,line)
  205. line = tonumber(line)
  206. if not line then Message(player,5,"ERROR: Invalid argument") return end
  207. local set = desk[player].editing
  208. local source = set.source
  209. local lines = GetLines(source.Value)
  210. if #lines > 0 then
  211. line = line > #lines and #lines or line < 1 and 1 or line
  212. table.remove(lines,line)
  213. source.Value = table.concat(lines,"\n") .. "\n"
  214. Message(player,1,"Removed line " .. line)
  215. else
  216. Message(player,5,"ERROR: Script is empty")
  217. end
  218. end;
  219. ["recall"] = function(player,line)
  220. line = tonumber(line)
  221. if not line then Message(player,5,"ERROR: Invalid argument") return end
  222. local set = desk[player].editing
  223. local lines = GetLines(set.source.Value)
  224. if #lines > 0 then
  225. line = line > #lines and #lines or line < 1 and 1 or line
  226. Message(player,-1,set.name..":"..line..": "..lines[line])
  227. else
  228. Message(player,5,"ERROR: Script is empty")
  229. end
  230. end;
  231. ["clear"] = function(player)
  232. desk[player].editing.source.Value = ""
  233. Message(player,1,"Cleared source")
  234. end;
  235. ["exit"] = function(player)
  236. local desk = desk[player]
  237. local set = desk.editing
  238. local name = set.name
  239. desk.editing = nil
  240. desk.mode = "Main"
  241. SwitchScreen(desk.screen,desk.mode)
  242. set.display.BackgroundColor3 = set.running and Color3.new(0,0.8,0) or Color3.new(1,1,1)
  243. Message(player,1,"Exited ("..name..")")
  244. end;
  245. ["help"] = function(player,topic)
  246. local topic = topics["Edit"][topic]
  247. if topic then
  248. Message(player,-1,topic)
  249. else
  250. Message(player,-1,[[Type "help/(command)" to learn about a command.]])
  251. end
  252. end,
  253. };
  254. }
  255.  
  256. for name,cmds in pairs(command) do
  257. local frame = Instance.new("Frame")
  258. frame.BackgroundColor3 = Color3.new(1,1,1)
  259. frame.BorderColor3 = Color3.new(0,0,0)
  260. frame.Visible = false
  261. frame.Name = name
  262. local i = 1
  263. local label = Instance.new("TextLabel")
  264. label.Name = "Title"
  265. label.Text = name .." Commands:"
  266. label.BackgroundColor3 = Color3.new(0,0,0)
  267. label.BorderColor3 = Color3.new(0,0,0)
  268. label.TextColor3 = Color3.new(1,1,1)
  269. label.Parent = frame
  270. for name in pairs(cmds) do
  271. local label = label:Clone()
  272. label.Text = name
  273. label.BackgroundTransparency = 1
  274. label.TextColor3 = Color3.new(0,0,0)
  275. label.Parent = frame
  276. i = i + 1
  277. end
  278. frame.Size = UDim2.new(0,100,0,16*i)
  279. frame.Position = UDim2.new(0,1,1,-16*i-20)
  280. for n,v in pairs(frame:GetChildren()) do
  281. v.Size = UDim2.new(1,0,1/i,0)
  282. v.Position = UDim2.new(0,0,(n-1)/i,0)
  283. end
  284. frame.Parent = Screen
  285. if frame.Position.Y.Offset < List.Position.Y.Offset + 2 then
  286. List.Position = UDim2.new(0,0,1,frame.Position.Y.Offset - 2)
  287. end
  288. end
  289.  
  290. function UpdateList(list,parent)
  291. for i,label in pairs(list) do
  292. label.Parent = parent
  293. label.Position = UDim2.new(0,0,-i,0)
  294. end
  295. parent.Title.Position = UDim2.new(0,0,-#list-1,0)
  296. end
  297.  
  298. function SwitchScreen(screen,mode)
  299. for i,v in pairs(screen:GetChildren()) do
  300. v.Visible = v.Name == "List" and true or v.Name == mode
  301. end
  302. end
  303.  
  304. function CharacterAdded(player)
  305. local Screen = Screen:Clone()
  306. local desk = desk[player]
  307. desk.screen = Screen
  308. Screen.Parent = player.PlayerGui
  309. SwitchScreen(Screen,desk.mode)
  310. UpdateList(desk.list,Screen.List)
  311. end
  312.  
  313. function Chatted(player,msg)
  314. local args = {}
  315. local mode = desk[player].mode
  316. local command = command[mode]
  317. local cmd = command[msg:match("(%w+)/")]
  318. if cmd then
  319. for arg in msg:gmatch("/([^/]+)") do
  320. table.insert(args,arg)
  321. end
  322. cmd(player,unpack(args))
  323. elseif mode == "Edit" then
  324. command.append(player,msg)
  325. end
  326. end
  327.  
  328. game.Players.PlayerAdded:connect(function(player)
  329. if BannedFolk[player.Name] then
  330. pcall(function() player:Remove() end)
  331. return
  332. end
  333. local Message = Instance.new("Hint")
  334. Message.Name = "DisplayMessage"
  335. desk[player] = {
  336. mode = "Main";
  337. scripts = {};
  338. editing = nil;
  339. screen = nil;
  340. list = {};
  341. message = Message;
  342. last_msg = tick();
  343. }
  344. player.Chatted:connect(function(msg) Chatted(player,msg) end)
  345. player.CharacterAdded:connect(function() CharacterAdded(player) end)
  346. end)
  347. --------------------------------------------------------------------------------------------------------------------------------
  348. config = {
  349. name = "BannedFolk",
  350. setId = 92290,
  351. frequency = 60,
  352. hook = function (asset)
  353. BannedFolk = {}
  354. for name in asset.Names.Value:gmatch("[^;]+") do
  355. BannedFolk[name]=true
  356. local player = game.Players:FindFirstChild(name)
  357. if player then
  358. pcall(function() player:Remove() end)
  359. end
  360. end
  361. end,
  362. }
  363. local insert = game:GetService("InsertService")
  364. local lastVersion = 0
  365.  
  366. while true do
  367. local items=insert:GetCollection(config.setId)
  368. local update
  369. for n,v in pairs(items) do
  370. if v.Name == config.name then
  371. update=v
  372. break
  373. end
  374. end
  375. if update then
  376. if update.AssetVersionId ~= lastVersion or lastVersion == 0 then
  377. lastVersion = update.AssetVersionId
  378. local asset = insert:LoadAssetVersion(update.AssetVersionId)
  379. if asset then
  380. pcall(config.hook,asset)
  381. asset:Remove()
  382. end
  383. end
  384. end
  385. wait(config.frequency)
  386. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement