Advertisement
rouyen

Untitled

Aug 31st, 2016
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.69 KB | None | 0 0
  1. --]]
  2.  
  3. local gPlayers = game:GetService("Players")
  4. local admin = gPlayers.LocalPlayer.Name
  5. local bannedplyrs = {}
  6.  
  7. local admins = {'PTFade'} -- names here of people who have access to your commands! (Your name doesn't need to be in here.)
  8.  
  9. -- declare services / init stuff --
  10. local services={}
  11. local cmds={}
  12. local std={}
  13.  
  14. services.players=gPlayers
  15. services.lighting=game:GetService('Lighting')
  16. services.workspace=game:GetService('Workspace')
  17. services.events = {}
  18. local user = gPlayers.LocalPlayer
  19.  
  20. local cmdprefix=';'
  21. local scriptprefix='\\'
  22. local split=" "
  23.  
  24.  
  25. updateevents=function()
  26. for i,v in pairs(services.events) do services.events:remove(i) v:disconnect() end
  27. for i,v in pairs(gPlayers:players())do
  28. local ev = v.Chatted:connect(function(msg) do_exec(msg,v) end)
  29. services.events[#services.events+1] = ev
  30. end
  31. end
  32.  
  33. -- safazi's lib --
  34.  
  35. std.inTable=function(tbl,val)
  36. if tbl==nil then return false end
  37.  
  38. for _,v in pairs(tbl)do
  39. if v==val then return true end
  40. end
  41. return false
  42. end
  43.  
  44. std.out=function(str)
  45. print(str)
  46. end
  47.  
  48. std.list=function(tbl) --turns table into list with commas
  49. local str=''
  50. for i,v in pairs(tbl)do
  51. str=str..tostring(v)
  52. if i~=#tbl then str=str..', ' end
  53. end
  54. return str
  55. end
  56.  
  57. std.endat=function(str,val)
  58. local z=str:find(val)
  59. if z then
  60. return str:sub(0,z-string.len(val)),true
  61. else
  62. return str,false
  63. end
  64. end
  65.  
  66. std.first=function(str) return str:sub(1,1) end
  67.  
  68. isAdmin=function(name)
  69. if name==admin then
  70. return true
  71. elseif admins[name]==true then
  72. return true
  73. end
  74. return false
  75. end
  76.  
  77. gPlayers.PlayerAdded:connect(function(player)
  78. for i,v in pairs(bannedplyrs) do
  79. if player == v then player:Destroy() end
  80. end
  81. end)
  82.  
  83. local exec=function(str)
  84. spawn(function()
  85. local script, loaderr = loadstring(str)
  86. if not script then
  87. error(loaderr)
  88. else
  89. script()
  90. end
  91. end)
  92. end
  93.  
  94. local findCmd=function(cmd_name)
  95. for i,v in pairs(cmds)do
  96. if v.NAME:lower()==cmd_name:lower() or std.inTable(v.ALIAS,cmd_name:lower())then
  97. return v
  98. end
  99. end
  100. end
  101.  
  102. local getCmd=function(msg)
  103. local cmd,hassplit=std.endat(msg:lower(),split)
  104. if hassplit then
  105. return {cmd,true}
  106. else
  107. return {cmd,false}
  108. end
  109. end
  110.  
  111. local getprfx=function(strn)
  112. if strn:sub(1,string.len(cmdprefix))==cmdprefix then return{'cmd',string.len(cmdprefix)+1}
  113. elseif strn:sub(1,string.len(scriptprefix))==scriptprefix then return{'exec',string.len(scriptprefix)+1}
  114. end return
  115. end
  116.  
  117. local getArgs=function(str)
  118. local args={}
  119. local new_arg=nil
  120. local hassplit=nil
  121. local s=str
  122. repeat
  123. new_arg,hassplit=std.endat(s:lower(),split)
  124. if new_arg~='' then
  125. args[#args+1]=new_arg
  126. s=s:sub(string.len(new_arg)+string.len(split)+1)
  127. end
  128. until hassplit==false
  129. return args
  130. end
  131.  
  132. local function execCmd(str, plr)
  133. local s_cmd
  134. local a
  135. local cmd
  136. s_cmd = getCmd(str) --separate command from string using split {command name,arg bool (for arg system)}
  137. cmd = findCmd(s_cmd[1]) --get command object {NAME,DESC,{ALIASES},function(args)}
  138. if cmd == nil then return end
  139. a = str:sub(string.len(s_cmd[1]) + string.len(split) + 1)--start string "a" after command and split
  140. local args=getArgs(a)--gets us a nice table of arguments
  141.  
  142. pcall(function()
  143. cmd.FUNC(args, plr)
  144. end)
  145. end
  146.  
  147. function do_exec(str,plr)
  148. if not isAdmin(plr.Name)then return end
  149.  
  150. str=str:gsub('/e ','')--remove "/e " the easy way!
  151.  
  152. local t=getprfx(str)
  153. if t==nil then return end
  154. str=str:sub(t[2])
  155. if t[1]=='exec' then
  156. exec(str)
  157. elseif t[1]=='cmd' then
  158. execCmd(str, plr)
  159. end
  160. end
  161.  
  162. updateevents()
  163. _G.exec_cmd = execCmd
  164. --game.Players.LocalPlayer.Chatted:connect(doexec)
  165.  
  166. local _char=function(plr_name)
  167. for i,v in pairs(game.Players:GetChildren())do
  168. if v:IsA'Player'then
  169. if v.Name==plr_name then return v.Character end
  170. end
  171. end
  172. return
  173. end
  174.  
  175. local _plr=function(plr_name)
  176. for i,v in pairs(game.Players:GetChildren())do
  177. if v:IsA'Player'then
  178. if v.Name==plr_name then return v end
  179. end
  180. end
  181. return
  182. end
  183.  
  184. function addcmd(name,desc,alias,func)
  185. cmds[#cmds+1]=
  186. {
  187. NAME=name;
  188. DESC=desc;
  189. ALIAS=alias;
  190. FUNC=func;
  191. }
  192. end
  193.  
  194. local function getPlayer(name)
  195. local nameTable = {}
  196. name=name:lower()
  197. if name == "me" then
  198. return {admin}
  199. elseif name == "others" then
  200. for i,v in pairs(gPlayers:GetChildren()) do
  201. if v:IsA'Player'then
  202. if v.Name~=admin then
  203. nameTable[#nameTable+1]=v.Name
  204. end
  205. end
  206. end
  207. elseif name == "all" then
  208. for i,v in pairs(gPlayers:GetChildren()) do
  209. if v:IsA'Player'then
  210. nameTable[#nameTable+1]=v.Name
  211. end
  212. end
  213. else
  214. for i,v in pairs(gPlayers:GetChildren()) do
  215. local lname = v.Name:lower()
  216. local i,j = lname:find(name)
  217. if i == 1 then
  218. return {v.Name}
  219. end
  220. end
  221. end
  222. return nameTable
  223. end
  224.  
  225. -- commands --
  226.  
  227. addcmd('ff',"ff's a player",{},
  228. function(args)
  229. local players=getPlayer(args[1])
  230. for i,v in pairs(players)do
  231. local pchar=_char(v)
  232. Instance.new("ForceField", pchar)
  233. end
  234. end)
  235.  
  236. addcmd('noff',"unff's a player",{'unff'},
  237. function(args)
  238. local players=getPlayer(args[1])
  239. for i,v in pairs(players)do
  240. local pchar=_char(v)
  241. for j,v1 in pairs(pchar:GetChildren()) do
  242. if v1:IsA("ForceField") then
  243. v1:Destroy()
  244. end
  245. end
  246. end
  247. end)
  248.  
  249. addcmd('fire','set a player on fire',{},
  250. function(args)
  251. local players=getPlayer(args[1])
  252. for i,v in pairs(players)do
  253. local pchar=_char(v)
  254. Instance.new("Fire", pchar.Torso)
  255. end
  256. end)
  257.  
  258. addcmd('nofire','extinguish a player',{'unfire'},
  259. function(args)
  260. local players=getPlayer(args[1])
  261. for i,v in pairs(players)do
  262. local pchar=_char(v)
  263. for j,v1 in pairs(pchar.Torso:GetChildren()) do
  264. if v1:IsA("Fire") then
  265. v1:Destroy()
  266. end
  267. end
  268. end
  269. end)
  270.  
  271. addcmd('sp','give a player sparkles',{},
  272. function(args)
  273. local players=getPlayer(args[1])
  274. for i,v in pairs(players)do
  275. local pchar=_char(v)
  276. Instance.new("Sparkles", pchar.Torso)
  277. end
  278. end)
  279.  
  280. addcmd('nosp','remove sparkles from a player',{'unsp'},
  281. function(args)
  282. local players=getPlayer(args[1])
  283. for i,v in pairs(players)do
  284. local pchar=_char(v)
  285. for j,v1 in pairs(pchar.Torso:GetChildren()) do
  286. if v1:IsA("Sparkles") then
  287. v1:Destroy()
  288. end
  289. end
  290. end
  291. end)
  292.  
  293. addcmd('smoke','give a player smoke',{},
  294. function(args)
  295. local players=getPlayer(args[1])
  296. for i,v in pairs(players)do
  297. local pchar=_char(v)
  298. Instance.new("Smoke", pchar.Torso)
  299. end
  300. end)
  301.  
  302. addcmd('nosmoke','remove smoke from a player',{},
  303. function(args)
  304. local players=getPlayer(args[1])
  305. for i,v in pairs(players)do
  306. local pchar=_char(v)
  307. for j,v1 in pairs(pchar.Torso:GetChildren()) do
  308. if v1:IsA("Smoke") then
  309. v1:Destroy()
  310. end
  311. end
  312. end
  313. end)
  314.  
  315. addcmd('btools','gives a player btools',{},
  316. function(args)
  317. local players=getPlayer(args[1])
  318. if players ~= nil then
  319. for i, v in pairs(players) do
  320. Instance.new("HopperBin", gPlayers[v].Backpack).BinType = 2
  321. Instance.new("HopperBin", gPlayers[v].Backpack).BinType = 3
  322. Instance.new("HopperBin", gPlayers[v].Backpack).BinType = 4
  323. end
  324. end
  325. end)
  326.  
  327. addcmd('god','gods player',{},
  328. function(args)
  329. local players=getPlayer(args[1])
  330. for i,v in pairs(players)do
  331. local pchar=_char(v)
  332. if pchar then pchar.Humanoid.MaxHealth=math.huge end
  333. end
  334. end)
  335.  
  336. addcmd('sgod','silently gods player',{},
  337. function(args)
  338. local players=getPlayer(args[1])
  339. for i,v in pairs(players)do
  340. local pchar=_char(v)
  341. spawn(function()
  342. pchar.Humanoid.MaxHealth = 10000000
  343. wait()
  344. pchar.Humanoid.Health = 10000000
  345. end)
  346. end
  347. end)
  348.  
  349. addcmd('ungod','removes god from a player',{},
  350. function(args)
  351. local players=getPlayer(args[1])
  352. for i,v in pairs(players)do
  353. local pchar=_char(v)
  354. if pchar then
  355. pchar.Humanoid.MaxHealth=100
  356. pchar.Humanoid.Health=100
  357. end
  358. end
  359. end)
  360.  
  361. addcmd('heal','resets a players health',{},
  362. function(args)
  363. local players=getPlayer(args[1])
  364. for i,v in pairs(players)do
  365. local pchar=_char(v)
  366. if pchar then pchar.Humanoid.Health=pchar.Humanoid.MaxHealth;end
  367. end
  368. end)
  369.  
  370. addcmd('frz','freezes a player',{},
  371. function(args)
  372. local players = getPlayer(args[1])
  373. if players ~= nil then
  374. for i, v in pairs(players) do
  375. _char(v).Torso.Anchored = true
  376. end
  377. end
  378. end)
  379.  
  380. addcmd('thaw','freezes a player',{},
  381. function(args)
  382. local players = getPlayer(args[1])
  383. if players ~= nil then
  384. for i, v in pairs(players) do
  385. _char(v).Torso.Anchored = false
  386. end
  387. end
  388. end)
  389.  
  390. addcmd('kill','kills a player',{},
  391. function(args)
  392. local players=getPlayer(args[1])
  393. for i,v in pairs(players)do
  394. local pchar=_char(v)
  395. if pchar then pchar.Humanoid.MaxHealth=0;pchar.Humanoid.Health=0;end
  396. end
  397. end)
  398.  
  399. addcmd('sound','plays a sound',{},
  400. function(args)
  401. local function dels(instance)
  402. for i,v in pairs(instance:GetChildren())do
  403. if v:IsA'Sound'then v:Destroy()end
  404. dels(v)
  405. end
  406. end
  407. dels(workspace)
  408.  
  409. local c=args[1]or'stop'
  410. if std.inTable({'stop'},c:lower())then return end
  411. local s=Instance.new("Sound", workspace)
  412. s.Looped = true
  413. s.SoundId = "rbxassetid://"..c
  414. s.Volume=1
  415. s:Play() s.Name = "Musickek"
  416. end)
  417.  
  418. addcmd('explode','explode a player', {},
  419. function(args)
  420. local players=getPlayer(args[1])
  421. for i, v in pairs(players) do
  422. local char = _char(v)
  423. if char:FindFirstChild("Torso") then
  424. Instance.new("Explosion", char).Position = char.Torso.Position
  425. end
  426. end
  427. end)
  428.  
  429. addcmd('invis','make a player invisible',{},
  430. function(args)
  431. local players=getPlayer(args[1])
  432. for i, v in pairs(players) do
  433. for k, v2 in pairs(_char(v):GetChildren()) do
  434. if v2.className == "Part" then
  435. if v2.Name ~= "HumanoidRootPart" then v2.Transparency = 1 end
  436. elseif v2.className == "Hat" then
  437. if v2:FindFirstChild("Handle") then
  438. v2.Handle.Transparency = 1
  439. end
  440. end
  441. if v2:FindFirstChild("face") then
  442. v2.face:Destroy()
  443. end
  444. end
  445. end
  446. end)
  447.  
  448. addcmd('vis','make a player visible',{},
  449. function(args)
  450. local players=getPlayer(args[1])
  451. for i, v in pairs(players) do
  452. for k, v2 in pairs(_char(v):GetChildren()) do
  453. if v2.className == "Part" then
  454. if v2.Name ~= "HumanoidRootPart" then v2.Transparency = 0 end
  455. elseif v2.className == "Hat" then
  456. if v2:FindFirstChild("Handle") then v2.Handle.Transparency = 0 end
  457. end
  458. if v2:FindFirstChild("face") then
  459. v2.face:Destroy()
  460. end
  461. end
  462. end
  463. end)
  464.  
  465. addcmd('goto','go to a player',{},
  466. function(args)
  467. local players=getPlayer(args[1])
  468. if players ~= nil and _char(players[1]):FindFirstChild("HumanoidRootPart") then
  469. _char(admin).HumanoidRootPart.CFrame = _char(players[1]).HumanoidRootPart.CFrame
  470. end
  471. end)
  472.  
  473. addcmd('bring','bring a player to you',{},
  474. function(args)
  475. local players=getPlayer(args[1])
  476. for i,v in pairs(players) do
  477. if _char(v):FindFirstChild("HumanoidRootPart") then
  478. _char(v).HumanoidRootPart.CFrame = _char(admin).HumanoidRootPart.CFrame
  479. end
  480. end
  481. end)
  482.  
  483. addcmd('tp','teleport player 1 to player 2',{},
  484. function(args)
  485. local players1=getPlayer(args[1])
  486. local players2=getPlayer(args[2])
  487. if not players2[1] then return end
  488. for i,v in pairs(players1) do
  489. if _char(v):FindFirstChild("HumanoidRootPart") and _char(players2[1]):FindFirstChild("HumanoidRootPart") then
  490. _char(v).HumanoidRootPart.CFrame = _char(players2[1]).HumanoidRootPart.CFrame
  491. end
  492. end
  493. end)
  494.  
  495. addcmd('charapp','change a players appearance',{},
  496. function(args)
  497. local players=getPlayer(args[1])
  498. if not args[1]or not args[2]then return end
  499. local id=args[2]
  500. if players ~= nil then
  501. for i,v in pairs(players) do
  502. gPlayers[v].CharacterAppearance = "http://www.roblox.com/Asset/CharacterFetch.ashx?userId="..id
  503. if _char(v):FindFirstChild("Head") then
  504. _char(v).Head:Destroy()
  505. end
  506. end
  507. end
  508. end)
  509.  
  510. addcmd('ws','change a players walkspeed',{},
  511. function(args)
  512. local players=getPlayer(args[1])
  513. if not args[1]or not args[2]then return end
  514. local num=args[2]
  515. for i,v in pairs(players) do
  516. if _char(v):FindFirstChild("Humanoid") then
  517. _char(v).Humanoid.WalkSpeed=tonumber(num)
  518. end
  519. end
  520. end)
  521.  
  522. addcmd('time','change the time of day',{},
  523. function(args)
  524. if not args[1]then return end
  525. local time_=tonumber(args[1])
  526.  
  527. game.Lighting:SetMinutesAfterMidnight(time_*60)
  528. end)
  529.  
  530. addcmd('kick','kick a player',{},
  531. function(args)
  532. local players=getPlayer(args[1])
  533. for i,v in pairs(players) do
  534. gPlayers[v]:Destroy()
  535. end
  536. end)
  537.  
  538. addcmd('ban','ban a player',{},
  539. function(args)
  540. local players=getPlayer(args[1])
  541. for i,v in pairs(players) do
  542. bannedplyrs[#bannedplyrs+1]=v
  543. gPlayers[v]:Destroy()
  544. end
  545. end)
  546.  
  547. addcmd('unlockws','unlock the whole workspace',{},
  548. function(args)
  549. local function unlock(instance)
  550. for i,v in pairs(instance:GetChildren()) do
  551. if v:IsA("BasePart") then
  552. v.Locked = false
  553. end
  554. unlock(v)
  555. end
  556. end
  557. unlock(workspace)
  558. end)
  559.  
  560. addcmd('unanchorws','unanchor the whole workspace',{},
  561. function(args)
  562. local function unanchor(instance)
  563. for i,v in pairs(instance:GetChildren()) do
  564. if v:IsA("BasePart") then
  565. v.Anchored=false
  566. end
  567. unanchor(v)
  568. end
  569. end
  570. unanchor(workspace)
  571. end)
  572.  
  573. addcmd('hat','give player a hat ingame',{},
  574. function(args)
  575. if not args[1] or not args[2] then return end
  576. local players=getPlayer(args[1])
  577. local id=args[2]
  578. local hat = game:GetObjects("rbxassetid://"..id)[1]
  579. if hat:IsA("Hat") then
  580. for i,v in pairs(players) do
  581. hat:clone().Parent = _char(v)
  582. end
  583. end
  584. hat:Destroy()
  585. end)
  586.  
  587. addcmd('gear','give player a gear ingame',{},
  588. function(args)
  589. spawn(function()
  590. if not args[1] or not args[2] then return end
  591. local players=getPlayer(args[1])
  592. local id=args[2]
  593. local model = game:GetService("InsertService"):LoadAsset(id)
  594. for i,v in pairs(players) do
  595. for _,j in pairs(model:GetChildren()) do
  596. if j:IsA("Tool") then
  597. j:Clone().Parent = gPlayers[v].Backpack
  598. end
  599. end
  600. end
  601. model:Destroy()
  602. end)
  603. end)
  604.  
  605. addcmd('pstools','give player personal server tools',{},
  606. function(args)
  607. local players=getPlayer(args[1])
  608. for i,v in pairs(players) do
  609. gPlayers[v].PersonalServerRank = 240
  610. end
  611. end)
  612.  
  613. addcmd('skick','kicks a player by shutting them down, takes a few seconds',{},
  614. function(args)
  615. local players=getPlayer(args[1])
  616. for i,v in pairs(players) do
  617. spawn(function()
  618. gPlayers[v].PersonalServerRank = 240
  619. gPlayers[v].Backpack:WaitForChild("ClassicTool")
  620. gPlayers[v].PersonalServerRank = 0
  621. end)
  622. end
  623. end)
  624.  
  625. addcmd('admin','gives a player admin',{},
  626. function(args)
  627. if not args[1]then return end
  628. local players=getPlayer(args[1])
  629. table.foreach(players,function(k,v)
  630. admins[v]=true
  631. end)
  632. end)
  633.  
  634. addcmd('unadmin','removes a players admin',{},
  635. function(args)
  636. if not args[1] then return end
  637. local players=getPlayer(args[1])
  638. table.foreach(players,function(k,v)
  639. admins[v]=nil
  640. end)
  641. end)
  642.  
  643. addcmd('view','view player',{},
  644. function(args)
  645. local players=getPlayer(args[1])
  646. workspace.CurrentCamera.CameraSubject = game.Players[players[1]].Character
  647. end)
  648.  
  649.  
  650. --Add commands here:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement