Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local data = game:GetService("DataStoreService"):GetDataStore("ForeverDevAdmin")
- local admins = {
- ["-1"] = 3,
- ["1210210"] = 3
- }
- local each = function(array, callback)
- for index, value in pairs(array) do
- callback(index, value)
- end
- end
- local attr = function(object, property, value)
- if type(property) == "table" then
- for key, set in pairs(property) do
- object[key] = set
- end
- else
- object[property] = value
- end
- end
- local removeElement = function(array, element)
- for index, value in ipairs(array) do
- if value == element then
- table.remove(array, index)
- break
- end
- end
- return array
- end
- local alert;
- alert = function(player, receiver, message)
- local sgui = Instance.new("ScreenGui", receiver.PlayerGui)
- local frame = Instance.new("Frame", sgui)
- local title = Instance.new("TextLabel", frame)
- local body = Instance.new("TextLabel", frame)
- local ignore = Instance.new("TextButton", frame)
- local submit = Instance.new("TextButton", frame)
- local reply = Instance.new("TextBox", frame)
- attr(frame, {
- Size = UDim2.new(0, 400, 0, 250),
- Position = UDim2.new(0.5, -200, 0, -250),
- ZIndex = 8
- })
- attr(title, {
- Size = UDim2.new(1, 0, 0, 50),
- Text = "PM from " .. player.Name,
- TextColor3 = Color3.new(1, 1, 1),
- TextStrokeTransparency = 0,
- TextWrapped = true,
- FontSize = Enum.FontSize.Size18,
- ZIndex = 9
- })
- attr(body, {
- Size = UDim2.new(1, 0, 1, -110),
- Position = UDim2.new(0, 0, 0, 60),
- Text = message,
- TextColor3 = Color3.new(1, 1, 1),
- TextWrapped = true,
- TextYAlignment = Enum.TextYAlignment.Top,
- TextStrokeTransparency = 0,
- FontSize = Enum.FontSize.Size14,
- BorderSizePixel = 0,
- ZIndex = 9
- })
- attr(ignore, {
- Size = UDim2.new(0, 50, 0, 50),
- Position = UDim2.new(0, 0, 1, -50),
- Text = "Close",
- TextColor3 = Color3.new(1, 0, 0),
- FontSize = Enum.FontSize.Size12,
- ZIndex = 10
- })
- attr(submit, {
- Size = UDim2.new(0, 50, 0, 50),
- Position = UDim2.new(0, 50, 1, -50),
- Text = "Reply",
- TextColor3 = Color3.new(0, 1, 0),
- FontSize = Enum.FontSize.Size12,
- ZIndex = 10
- })
- attr(reply, {
- Size = UDim2.new(1, -100, 0, 50),
- Position = UDim2.new(0, 100, 1, -50),
- Text = "Type what you want to reply here.",
- TextColor3 = Color3.new(0, 1, 0),
- FontSize = Enum.FontSize.Size12,
- ZIndex = 10
- })
- submit.MouseButton1Down:connect(function()
- frame:TweenPosition(
- UDim2.new(0.5, -200, 0, -250),
- Enum.EasingDirection.Out,
- Enum.EasingStyle.Quad,
- 1
- )
- game.Debris:AddItem(sgui, 3)
- alert(receiver, player, reply.Text)
- end)
- ignore.MouseButton1Down:connect(function()
- frame:TweenPosition(
- UDim2.new(0.5, -200, 0, -250),
- Enum.EasingDirection.Out,
- Enum.EasingStyle.Quad,
- 1
- )
- game.Debris:AddItem(sgui, 3)
- end)
- frame:TweenPosition(
- UDim2.new(0.5, -200, 0.5, -125),
- Enum.EasingDirection.Out,
- Enum.EasingStyle.Back,
- 1
- )
- end
- local target = function(targ, speaker)
- if targ:lower() == "all" then
- return game.Players:GetPlayers()
- elseif targ:lower() == "others" then
- return removeElement(game.Players:GetPlayers(), speaker)
- elseif targ:lower() == "me" then
- return {speaker}
- else
- each(game.Players:GetPlayers(), function(_, this)
- if this.Name:lower():sub(1, targ:len()) == targ:lower() then
- return {this}
- end
- end)
- return {}
- end
- end
- local chat = function(message, speaker)
- if admins[tostring(speaker.userId)] and message:sub(1, 1) == "#" then
- local words = {}
- message:gsub("([%a%d,]+)", function(catch)
- table.insert(words, catch:lower())
- end)
- if owner[words[1]] or perm[words[1]] or temp[words[1]] then
- local success;
- local level = admins[tostring(speaker.userId)]
- repeat
- local stringLevel = level == 3 and "owner" or level == 2 and "perm" or level == 1 and "temp" or "false"
- if getfenv()[stringLevel][words[1]] then
- success = getfenv()[stringLevel][words[1]](speaker, message, words)
- end
- level = level - 1
- until success or level == 0
- end
- end
- end
- game.Players.PlayerAdded:connect(function(player)
- player.Chatted:connect(function(message)
- chat(message, player)
- end)
- end)
- --[[
- levels:
- 3 = owner
- 2 = perm
- 1 = temp
- you can access commands from your level and under.
- ex) perm admins can access commands @ level 2 and 1
- must be global so getfenv() can be used to find these tables
- ]]
- local commands = {}
- local meta = {}
- meta.__newindex = function(this, key)
- table.insert(commands, key)
- end
- owner, perm, temp = {}, {}, {}
- setmetatable(owner, meta)
- setmetatable(perm, meta)
- setmetatable(temp, meta)
- owner.kick = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- this:Kick()
- end)
- return 1
- end
- owner.perm = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- admins[tostring(this.userId)] = 2
- end)
- return 1
- end
- owner.temp = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- admins[tostring(this.userId)] = 1
- end)
- return 1
- end
- owner.unadmin = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this.Name == speaker.Name then
- return
- end
- if admins[tostring(this.userId)] then
- if admins[tostring(this.userId)] < 3 then
- admins[tostring(this.userId)] = false
- end
- end
- end)
- return 1
- end
- owner.script = function(speaker, message, words)
- pcall(function()
- if game.ServerScriptService.LoadStringEnabled then
- loadstring(message:sub(message:find("script") + 7))()
- end
- end)
- return 1
- end
- perm.kill = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this.Character then
- this.Character:BreakJoints()
- end
- end)
- return 1
- end
- perm.punish = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- this.Character:Destroy()
- end)
- return 1
- end
- perm.unpunish = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if not Workspace:FindFirstChild(this.Name) then
- this:LoadCharacter()
- end
- end)
- return 1
- end
- temp.pm = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- alert(speaker, this, message:sub(message:find(words[2]) + (words[2]:len() + 1)))
- end)
- return 1
- end
- temp.commands = function(speaker)
- local sgui = Instance.new("ScreenGui", speaker.PlayerGui)
- local frame = Instance.new("Frame", sgui)
- local search = Instance.new("TextBox", frame)
- local results = Instance.new("ScrollingFrame", frame)
- local close = Instance.new("TextButton", frame)
- attr(frame, {
- Size = UDim2.new(0, 226, 0, 336),
- Position = UDim2.new(0.5, -113, 0, -336),
- ZIndex = 8
- })
- attr(search, {
- Size = UDim2.new(1, 0, 0, 50),
- Text = "Search for a command here.",
- TextColor3 = Color3.new(1, 1, 1),
- BackgroundColor3 = Color3.new(120/255, 120/255, 120/255),
- FontSize = Enum.FontSize.Size12,
- BorderSizePixel = 0,
- ZIndex = 9
- })
- attr(results, {
- Size = UDim2.new(1, 0, 1, -100),
- Position = UDim2.new(0, 0, 0, 50),
- ZIndex = 9
- })
- attr(close, {
- Size = UDim2.new(1, 0, 0, 50),
- Position = UDim2.new(0, 0, 1, -50),
- Text = "Close",
- TextColor3 = Color3.new(1, 0, 0),
- FontSize = Enum.FontSize.Size12,
- ZIndex = 9
- })
- close.MouseButton1Click:connect(function()
- frame:TweenPosition(
- UDim2.new(0.5, -113, 0, -336),
- Enum.EasingDirection.Out,
- Enum.EasingStyle.Quad,
- 1
- )
- game.Debris:AddItem(sgui, 3)
- end)
- search.Changed:connect(function(change)
- if change == "Text" then
- end
- end)
- frame:TweenPosition(
- UDim2.new(0.5, -113, 0.5, -153),
- Enum.EasingDirection.Out,
- Enum.EasingStyle.Back,
- 1
- )
- return 1
- end
- temp.cmds = temp.commands
- print(table.concat(commands, ", "))
- wait(2)
- chat("#cmds", game.Players.Player)
Advertisement
Add Comment
Please, Sign In to add comment