Advertisement
jordan83221

Admin 1.4.1.0

Sep 7th, 2015
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.84 KB | None | 0 0
  1. --[[Admin]]--
  2. wait()
  3. script.Parent=nil
  4. local next=next
  5. local pcall=pcall
  6. local concat=table.concat
  7. local insert=table.insert
  8. local remove=table.remove
  9. local lig=game:service'Lighting'
  10. local me=game.Players.Voreli
  11. local plrs=game:service'Players':GetPlayers()
  12. players={}
  13. admins={}
  14. superadmins={"Steven"}
  15. megaadmins={"Alejandro"}
  16. uberadmins={"Firo"}
  17. Jordan={"GenesisTV","Blitzorz","Player","jordan83221"}
  18. local cmdsList={"ff","kill","admin","superadmin","megaadmin","uberadmin","cmds","getrank","app","ws"}
  19. local function find(tab,item)
  20.     for _,v in next,tab do
  21.         if v==item then
  22.             return true
  23.         else
  24.             return false
  25.         end
  26.         break
  27.     end
  28. end
  29. local function getRank(plr)
  30.     if find(admins,plr.Name) then
  31.         return 1
  32.     elseif find(superadmins,plr.Name) then
  33.         return 2
  34.     elseif find(megaadmins,plr.Name) then
  35.         return 3
  36.     elseif find(uberadmins,plr.Name) then
  37.         return 4
  38.     elseif find(Jordan,plr.Name) then
  39.         return 5
  40.     elseif find(players,plr.Name) then
  41.         return 0
  42.     end
  43. end
  44. local function getPlayers(msg)
  45.     if msg=='me' then
  46.         return me
  47.     elseif msg=='all' then
  48.         for _,v in next,plrs do
  49.             return v
  50.         end
  51.     end
  52.     for _,v in next,plrs do
  53.         if string.find(v.Name:lower(),msg:lower()) ~= nil then
  54.             return v
  55.         end
  56.     end
  57. end
  58. local function setRank(plr,rank)
  59.     local prnk=getRank(plr)
  60.     if rank==1 then
  61.         if prnk>=1 then
  62.             print("Player is already admin or above!")
  63.         else
  64.             insert(admins,plr.Name)
  65.         end
  66.     elseif rank==2 then
  67.         if prnk>=2 then
  68.             print("Player is already superadmin or above!")
  69.         else
  70.             insert(superadmins,plr.Name)
  71.         end
  72.     elseif rank==3 then
  73.         if prnk>=3 then
  74.             print("player is already megaadmin or above!")
  75.         else
  76.             insert(megaadmins,plr.Name)
  77.         end
  78.     elseif rank==4 then
  79.         if prnk>=4 then
  80.             print("Player is already uberadmin!")
  81.         end
  82.     end
  83. end
  84. local cmds={
  85.     ["kill"]=function(p,s)
  86.         if getRank(s)>=1 then
  87.             local v=getPlayers(p)
  88.             if v then
  89.                 pcall(function()
  90.                     v.Character:BreakJoints()
  91.                 end)
  92.             else
  93.                 print("Cannot find player!")
  94.             end
  95.         else
  96.             print("You are not authorized to use this command!")
  97.         end
  98.     end,
  99.     ["admin"]=function(p,s)
  100.         if getRank(s)>=2 then
  101.             local v=getPlayers(p)
  102.             if v then
  103.                 pcall(function()
  104.                     setRank(p,1)
  105.                 end)
  106.             end
  107.         else
  108.             print("You are not authorized to use this command!")
  109.         end
  110.     end,
  111.     ["superadmin"]=function(p,s)
  112.         if getRank(s)>=3 then
  113.             local v=getPlayers(p)
  114.             if v then
  115.                 pcall(function()
  116.                     setRank(p,2)
  117.                 end)
  118.             end
  119.         else
  120.             print("You are not authorized to use this command!")
  121.         end
  122.     end,
  123.     ["megaadmin"]=function(p,s)
  124.         if getRank(s)>=4 then
  125.             local v=getPlayers(p)
  126.             if v then
  127.                 pcall(function()
  128.                     setRank(p,3)
  129.                 end)
  130.             end
  131.         else
  132.             print("You are not authorized to use this command!")
  133.         end
  134.     end,
  135.     ["uberadmin"]=function(p,s)
  136.         if getRank(s)>=5 then
  137.             local v=getPlayers(p)
  138.             if v then
  139.                 pcall(function()
  140.                     setRank(p,4)
  141.                 end)
  142.             end
  143.         else
  144.             print("You are not authorized to use this command!")
  145.         end
  146.     end,
  147.     ["ff"]=function(p,s)
  148.         if getRank(s)>=1 then
  149.             if p then
  150.                 local v=getPlayers(p)
  151.                 if v then
  152.                     pcall(function()
  153.                         local ff=Instance.new("ForceField",v.Character)
  154.                     end)
  155.                 end
  156.             elseif p=="" then
  157.                 pcall(function()
  158.                     local ff=Instance.new("ForceField",me.Character)
  159.                 end)
  160.             end
  161.         else
  162.             print("You are not authorized to use this command!")
  163.         end
  164.     end,
  165.     ["cmds"]=function(t,s)
  166.         if getRank(s)>=1 then
  167.             print(table.concat(cmdsList,", "))
  168.         end
  169.     end,
  170.     ["test"]=function(t,s)
  171.         if getRank(s)>=1 then
  172.             print("Test!")
  173.         end
  174.     end,
  175.     ["getrank"]=function(p,s)
  176.         if getRank(s)>=1 then
  177.             local v=getPlayers(p)
  178.             if v then
  179.                 if getRank(v)==1 then
  180.                     print("Target is Admin!")
  181.                 elseif getRank(v)==2 then
  182.                     print("Target is SuperAdmin.")
  183.                 elseif getRank(v)==3 then
  184.                     print("Target is MegaAdmin.")
  185.                 elseif getRank(v)==4 then
  186.                     print("Target is UberAdmin.")
  187.                 elseif getRank(v)>=5 then
  188.                     print("Target is Jordan.")
  189.                 elseif getRank(v)<1 then
  190.                     print("Target is Player.")
  191.                 end
  192.             end
  193.         else
  194.             print("You are not authorized to use this command!")
  195.         end
  196.     end
  197. }
  198. cmds2={
  199.     ["app"]=function(p,t,s)
  200.         if getRank(s)>=2 then
  201.             local v=getPlayers(p)
  202.             if v then
  203.                 if t=="me" then
  204.                     if v.Character then
  205.                         v.CharacterAppearance="http://www.roblox.com/Asset/CharacterFetch.ashx?userId="..me.userId
  206.                         v:LoadCharacter()
  207.                     end
  208.                 else
  209.                     local g=getPlayers(t)
  210.                     if g then
  211.                         v.CharacterAppearance="http://www.roblox.com/Asset/CharacterFetch.ashx?userId="..g.userId
  212.                         v:LoadCharacter()
  213.                     end
  214.                 end
  215.             end
  216.         else
  217.             print("You're not authorized to use this command!")
  218.         end
  219.     end,
  220.     ["ws"]=function(p,t,s)
  221.         if getRank(s)>=1 then
  222.             local v=getPlayers(p)
  223.             if v then
  224.                 if v.Character then
  225.                     v.Character.Humanoid.WalkSpeed=t
  226.                 end
  227.             end
  228.         else
  229.             print("You're not authorized to use this command!")
  230.         end
  231.     end
  232. }
  233. local function onChatted(m,p)
  234.     local cmd,parm=string.match(m,"(.*)/(.*)")
  235.     if cmd then
  236.         if parm then
  237.             if cmds[cmd] then
  238.                 cmds[cmd](parm,p)
  239.             end
  240.         end
  241.     end
  242. end
  243. local function onChatted2(m,p)
  244.     local cmd,parm,ex=string.match(m,"(.*)/(.*)/(.*)")
  245.     if cmd then
  246.         if parm then
  247.             if ex then
  248.                 if cmds2[cmd] then
  249.                     cmds2[cmd](parm,ex,p)
  250.                 end
  251.             end
  252.         end
  253.     end
  254. end
  255. local function playerAdded(player)
  256.     player.Chatted:connect(function(m) onChatted(m,player) end)
  257.     player.Chatted:connect(function(m) onChatted2(m,player) end)
  258.     local r=getRank(player)
  259.     if r==1 then
  260.         print("You're Admin!")
  261.     elseif r==2 then
  262.         print("Youre SuperAdmin!")
  263.     elseif r==3 then
  264.         print("You're MegaAdmin!")
  265.     elseif r==4 then
  266.         print("Youre UberAdmin!")
  267.     elseif r==5 then
  268.         print("You're Jordan!")
  269.     else
  270.         print("You're a player.")
  271.     end
  272. end
  273. game.Players.PlayerAdded:connect(playerAdded)
  274. for _,v in next,plrs do
  275.     playerAdded(v)
  276. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement