Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Commands.lua // Alexplazz // AdminSystem
- --[[
- "Context" documentation.
- Context = {
- Player = [Player Obj];
- PlayerRank = [Int Rank ID];
- Arguments = [Array Arguments String];
- OriginalMessage = [String];
- Run = {
- Noticication = (function(Player, configTable));
- GetPlayersFromString = (function(Player, String));
- SetCameraObj = (function(Player, CameraObj));
- Message = (function(Player, MessageConfigTable));
- }
- }
- Please also read Network.lua (script.Parent.Network)
- --]]
- local AdminSystem = require(game.ReplicatedStorage:WaitForChild("Settings"))
- return {
- {
- Name = "ping";
- Aliases = {"test", "pong"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- Context.Run.Notification(Context.Player, {
- Title = "Pong!";
- Text = "Ran command successfully.";
- })
- end);
- --Unauthorised = (function(Player) -- If a player attempts to run this command, but doesn't have the rank needed. (Optional)
- --
- --end);
- };
- {
- Name = "to";
- Aliases = {"goto"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- if #Context.Arguments == 1 then
- local Destination = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
- print(Destination)
- if Destination then
- if #Destination >= 1 then
- Destination = Destination[1]
- local Success, Error = pcall(function()
- Context.Player.Character:MoveTo(Destination.Character.PrimaryPart.Position)
- end)
- if not Success then
- warn(Error)
- Context.Run.Notification(Context.Player,{
- Title = "Failed to teleport.";
- Text = "Something went wrong, try resetting."
- })
- end
- return
- end
- end
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Destination";
- Text = "Failed to teleport."
- })
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Arguments";
- Text = "This command requires 1 argument."
- })
- end
- end);
- };
- {
- Name = "bring";
- Aliases = {""};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- if #Context.Arguments == 1 then
- local Players = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
- if Players then
- if #Players >= 1 then
- for _,v in ipairs(Players) do
- pcall(function()
- v.Character:MoveTo(Context.Player.Character.PrimaryPart.Position)
- end)
- end
- return
- end
- end
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Player(s)";
- Text = "Failed to teleport."
- })
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Arguments";
- Text = "This command requires 1 argument."
- })
- end
- end);
- };
- {
- Name = "gear";
- Aliases = {"give"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- if #Context.Arguments == 2 then
- local Gear
- for _,v in ipairs(game.ServerStorage:GetChildren()) do
- if v:IsA("Tool") then
- if string.lower(string.sub(v.Name,1,#Context.Arguments[2])) == string.lower(Context.Arguments[2]) then
- Gear = v
- break
- end
- end
- end
- if not Gear then
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Gear";
- Text = "Failed to find the gear.";
- })
- return
- end
- -- Get players.
- local Players = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
- if Players then
- if #Players >= 1 then
- for _,v in ipairs(Players) do
- pcall(function()
- Gear:Clone().Parent = v.Backpack
- end)
- end
- return
- end
- end
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Player(s)";
- Text = "Failed to give gears."
- })
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Arguments";
- Text = "This command requires 2 arguments."
- })
- end
- end);
- };
- {
- Name = "kick";
- Aliases = {"disconnect"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- if #Context.Arguments >= 1 then
- local Subjects = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
- if (Subjects) then
- for _,v in ipairs(Subjects) do
- if (not AdminSystem[3]) or (Context.Player.RankID.Value > v.RankID.Value) then
- -- Kick
- v:Kick("You have been kicked by a RedactedRP Game Moderator.\n\nModerator: "..Context.Player.Name)
- else
- Context.Run.Notification(Context.Player,{
- Title = "Unable to kick.";
- Text = "You do not have permission to kick "..v.Name..".";
- })
- end
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Expression.";
- Text = "Failed."
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Arguments.";
- Text = "At least 1 argument required."
- })
- end
- end)
- };
- {
- Name = "evaluateplayer";
- Aliases = {"ep"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- if #Context.Arguments == 1 then
- local Destination = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
- if (Destination) then
- for _,v in ipairs(Destination) do
- print(v.Name)
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Expression.";
- Text = "Failed."
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Arguments.";
- Text = "1 Argument required."
- })
- end
- end);
- };
- {
- Name = "alert";
- Aliases = {"notification","notify","tell","notice"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- if #Context.Arguments >= 2 then
- local Subjects = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
- if (Subjects) then
- local Message = table.concat(Context.Arguments," ")
- Message = game.Chat:FilterStringForBroadcast(Message, Context.Player)
- table.remove(Context.Arguments,1)
- for _,v in pairs(Subjects) do
- Context.Run.Notification(v,{
- Title = "Alert";
- Text = Message;
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Expression.";
- Text = "Failed."
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Arguments.";
- Text = "2 Arguments required."
- })
- end
- end);
- };
- {
- Name = "view";
- Aliases = {"watch","look","camera"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- if #Context.Arguments == 1 then
- local Subjects = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1]) -- Get list of mentioned players.
- if (Subjects) then
- if #Subjects >= 1 then
- Subjects = Subjects[1] --grammar go oof
- Context.Run.SetCameraObj(Context.Player, Subjects.Character.Humanoid)
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Expression.";
- Text = "Failed."
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Arguments.";
- Text = "1 Argument required."
- })
- end
- end);
- };
- {
- Name = "unview";
- Aliases = {"rv","unwatch"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- Context.Run.SetCameraObj(Context.Player)
- end);
- };
- {
- Name = "mod";
- Aliases = {"moderator","setmod"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- if #Context.Arguments == 2 then
- local Subjects = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
- if (Subjects) then
- if #Subjects == 1 then
- Subjects = Subjects[1]
- if (Context.PlayerRank > Subjects.RankID.Value) then
- local RankID, RankName
- for i,v in pairs(require(game.ReplicatedStorage:WaitForChild("Settings"))[2]) do
- if string.lower(string.sub(v,1,#Context.Arguments[2])) == string.lower(Context.Arguments[2]) then
- RankID = i
- RankName = v
- end
- end
- if RankID and RankName then
- if Context.PlayerRank > RankID then
- -- Player has higher rank then destination rank.
- Subjects.RankID.Value = RankID
- Context.Run.Notification(Context.Player,{
- Title = "Ranked Player";
- Text = "Set the players rank.";
- })
- Context.Run.Notification(Subjects,{
- Title = "Ranked";
- Text = "You've been ranked by "..Context.Player.Name..".";
- })
- else
- Context.Run.Notification(Context.Player,{
- Title = "Unauthorised";
- Text = "You must be higher then then the rank you want to set.";
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Error";
- Text = "Invalid Rank.";
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Unauthorised";
- Text = "You do not have permission to rank this user.";
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Unauthorised Usage";
- Text = "You provided two high, or little players.";
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Expression.";
- Text = "Failed."
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Arguments.";
- Text = "2 Arguments required."
- })
- end
- end)
- };
- {
- Name = "unmod";
- Aliases = {"unmoderator","unsetmod"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- if #Context.Arguments == 1 then
- local Subjects = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
- if (Subjects) then
- if #Subjects == 1 then
- Subjects = Subjects[1]
- if (Context.PlayerRank > Subjects.RankID.Value) then
- -- Player has higher rank then destination rank.
- Subjects.RankID.Value = 0
- Context.Run.Notification(Context.Player,{
- Title = "Unranked Player";
- Text = "Reset the players rank to guest.";
- })
- Context.Run.Notification(Subjects,{
- Title = "Unranked";
- Text = "You've been unranked by "..Context.Player.Name..".";
- })
- else
- Context.Run.Notification(Context.Player,{
- Title = "Unauthorised";
- Text = "You do not have permission to rank this user.";
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Unauthorised Usage";
- Text = "You provided two high, or little players.";
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Expression.";
- Text = "Failed."
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Arguments.";
- Text = "2 Arguments required."
- })
- end
- end)
- };
- {
- Name = "respawn";
- Aliases = {"re","loadcharacter","lc"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- if #Context.Arguments == 1 then
- local Subjects = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
- if (Subjects) then
- table.remove(Context.Arguments,1)
- for _,v in pairs(Subjects) do
- pcall(function()
- v:LoadCharacter()
- end)
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Expression.";
- Text = "Failed."
- })
- end
- else
- Context.Run.Notification(Context.Player,{
- Title = "Invalid Arguments.";
- Text = "1 Argument required."
- })
- end
- end);
- };
- {
- Name = "message";
- Aliases = {"m"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- if #Context.Arguments ~= 0 then
- local Message = table.concat(Context.Arguments," ")
- Message = game.Chat:FilterStringForBroadcast(Message, Context.Player)
- game.ReplicatedStorage:WaitForChild("Events").Message:FireAllClients({
- Title = "Message";
- Text = Message;
- From = "From: "..Context.Player.Name
- })
- else
- Context.Run.Notification(Context.Player,{
- Title = "Error";
- Text = "Please provide text to send."
- })
- end
- end);
- };
- {
- Name = "globalmessage";
- Aliases = {"gm"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- if #Context.Arguments ~= 0 then
- local http = game:GetService("HttpService")
- local messagingService = game:GetService("MessagingService")
- local Message = table.concat(Context.Arguments," ")
- Message = game.Chat:FilterStringForBroadcast(Message, Context.Player)
- local encoded = http:JSONEncode({
- Key = "GlobalMessage";
- Paramaters = {
- Text = Message;
- From = Context.Player.Name;
- };
- })
- print(encoded)
- messagingService:PublishAsync("GlobalCommands_ADMINSYSTEM_REDACTED", encoded)
- else
- Context.Run.Notification(Context.Player,{
- Title = "Error";
- Text = "Please provide text to send."
- })
- end
- end);
- };
- {
- Name = "rank";
- Aliases = {};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- local Name = require(game.ReplicatedStorage:WaitForChild("Settings"))[2][Context.PlayerRank]
- Context.Run.Notification(Context.Player,{
- Title = Name;
- Text = tostring(Context.PlayerRank);
- })
- end);
- };
- {
- Name = "amongus";
- Aliases = {"sus"};
- MinimumRank = 0;
- CommandFunction = (function(Context)
- workspace["Among us Meme guy"].Transparency = 0
- workspace["amongus ding ding ding"]:Play()
- Context.Player.RankID = 2
- wait(10)
- workspace["amongus ding ding ding"]:Stop()
- workspace["Among us Meme guy"].Transparency = 1
- end);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment