Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local admins = {
- [-1] = 3
- }
- 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 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 each = function(array, callback)
- for index, value in pairs(array) do
- callback(index, value)
- end
- end
- local chat = function(message, speaker)
- if admins[speaker.userId] then
- local words = {}
- message:gsub("([%a%d]+)", function(catch)
- table.insert(words, catch)
- end)
- if message:sub(1, 1) == "#" and (owner[words[1]] or perm[words[1]] or temp[words[1]]) then
- local success;
- local level = admins[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(chat)
- 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
- ]]
- owner, perm, temp = {}, {}, {}
- owner.kill = function(speaker, message, words)
- each(target(words[2], speaker), function(_, this)
- if this.Character then
- this.Character:BreakJoints()
- end
- end)
- return 1
- end
- wait(2)
- chat("#kill others", game.Players.Player1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement