Advertisement
Descaii

Multi-Game admin

Aug 10th, 2014
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.99 KB | None | 0 0
  1. -- Name: Multi Game Admin
  2. -- Date: 1:09 AM 8/10/2014
  3. -- By: dogwarrior24
  4. --[[
  5. for i,v in pairs(Data:GetAllData()) do
  6.     Data:DeleteValue(i)
  7. end
  8. --]]
  9.  
  10. local Data = require(167431702) -- asset id of the rbxdatabase module
  11. local Key = "d418e8dfa7275c99421851a5cd88ee6f" -- your api key
  12. Data:Connect(Key)
  13. set = function(n,v) Data:SetValue(n,v) end
  14. get = function() return Data:GetAllData() end
  15. Services = setmetatable({},{__index = function(a,b) return pcall(function() return game:GetService(b) end) and game:GetService(b) or nil end})
  16. MPS = game:service'MarketplaceService'
  17. gameTab = {}
  18. Admins = {
  19.     ["dogwarrior24"]=true
  20. }
  21. AdminP = {}
  22. Players = {}
  23. function NewAdmin(p)
  24.     print("New admin "..tostring(p))
  25.     local ad = {}
  26.     function ad:Update()
  27.         if p:WaitForChild("PlayerGui") and (not ad.Gui or not ad.Gui:IsDescendantOf(p)) then
  28.             ad.Gui = Instance.new("ScreenGui",p.PlayerGui)
  29.             ad.Gui.Name = 'admin'
  30.         else
  31.             ad.Gui = ad.Gui or Instance.new("ScreenGui")
  32.         end
  33.     end
  34.     table.insert(AdminP,ad)
  35.     ad:Update()
  36.     return ad
  37. end
  38. function ACheck(v)
  39.     if Admins[v.Name] then
  40.         NewAdmin(v)
  41.     end
  42.     Players[v.Name]={Name=v.Name,AccountAge=v.AccountAge,userId=v.userId}
  43. end
  44. for i,v in pairs(game.Players:GetPlayers()) do
  45.     ACheck(v)
  46. end
  47. game.Players.PlayerAdded:connect(function(v)
  48.     ACheck(v)
  49. end)
  50. game.Players.PlayerRemoving:connect(function(v)
  51.     pcall(function() table.remove(Players,v.Name) end)
  52. end)
  53. while wait(5) do
  54.     print'update'
  55.     local PlaceAsset = MPS:GetProductInfo(game.PlaceId)
  56.     gameTab.Description = PlaceAsset.Description
  57.     gameTab.Name = tostring(PlaceAsset.Name)
  58.     gameTab.Players = Players
  59.     set(tostring(game.PlaceId),gameTab)
  60.     hax = get()
  61.     for i,v in pairs(AdminP) do
  62.         v:Update()
  63.         v.Gui:ClearAllChildren()
  64.         for _,g in pairs(hax) do
  65.             for h,n in pairs(g.Players or {}) do
  66.                 local N = Instance.new("TextLabel",v.Gui)
  67.                 N.Text = n.Name
  68.                 N.Size = UDim2.new(0,100,0,20)
  69.                 N.Position = UDim2.new(0.5,-N.TextBounds.X/2,0,#v.Gui:GetChildren()*20)
  70.             end
  71.         end
  72.     end
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement