Alexplazz

Untitled

Oct 21st, 2021
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.69 KB | None | 0 0
  1. -- Commands.lua // Alexplazz // AdminSystem
  2.  
  3. --[[
  4. "Context" documentation.
  5. Context = {
  6. Player = [Player Obj];
  7. PlayerRank = [Int Rank ID];
  8. Arguments = [Array Arguments String];
  9. OriginalMessage = [String];
  10. Run = {
  11. Noticication = (function(Player, configTable));
  12. GetPlayersFromString = (function(Player, String));
  13. SetCameraObj = (function(Player, CameraObj));
  14. Message = (function(Player, MessageConfigTable));
  15. }
  16. }
  17. Please also read Network.lua (script.Parent.Network)
  18. --]]
  19. local AdminSystem = require(game.ReplicatedStorage:WaitForChild("Settings"))
  20. return {
  21.  
  22. {
  23. Name = "ping";
  24. Aliases = {"test", "pong"};
  25. MinimumRank = 0;
  26. CommandFunction = (function(Context)
  27. Context.Run.Notification(Context.Player, {
  28. Title = "Pong!";
  29. Text = "Ran command successfully.";
  30. })
  31. end);
  32. --Unauthorised = (function(Player) -- If a player attempts to run this command, but doesn't have the rank needed. (Optional)
  33. --
  34. --end);
  35. };
  36.  
  37. {
  38. Name = "to";
  39. Aliases = {"goto"};
  40. MinimumRank = 0;
  41. CommandFunction = (function(Context)
  42. if #Context.Arguments == 1 then
  43. local Destination = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
  44. print(Destination)
  45. if Destination then
  46. if #Destination >= 1 then
  47. Destination = Destination[1]
  48. local Success, Error = pcall(function()
  49. Context.Player.Character:MoveTo(Destination.Character.PrimaryPart.Position)
  50. end)
  51. if not Success then
  52. warn(Error)
  53. Context.Run.Notification(Context.Player,{
  54. Title = "Failed to teleport.";
  55. Text = "Something went wrong, try resetting."
  56. })
  57. end
  58. return
  59. end
  60. end
  61. Context.Run.Notification(Context.Player,{
  62. Title = "Invalid Destination";
  63. Text = "Failed to teleport."
  64. })
  65. else
  66. Context.Run.Notification(Context.Player,{
  67. Title = "Invalid Arguments";
  68. Text = "This command requires 1 argument."
  69. })
  70. end
  71. end);
  72. };
  73.  
  74. {
  75. Name = "bring";
  76. Aliases = {""};
  77. MinimumRank = 0;
  78. CommandFunction = (function(Context)
  79. if #Context.Arguments == 1 then
  80. local Players = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
  81. if Players then
  82. if #Players >= 1 then
  83. for _,v in ipairs(Players) do
  84. pcall(function()
  85. v.Character:MoveTo(Context.Player.Character.PrimaryPart.Position)
  86. end)
  87. end
  88. return
  89. end
  90. end
  91. Context.Run.Notification(Context.Player,{
  92. Title = "Invalid Player(s)";
  93. Text = "Failed to teleport."
  94. })
  95. else
  96. Context.Run.Notification(Context.Player,{
  97. Title = "Invalid Arguments";
  98. Text = "This command requires 1 argument."
  99. })
  100. end
  101. end);
  102. };
  103.  
  104. {
  105. Name = "gear";
  106. Aliases = {"give"};
  107. MinimumRank = 0;
  108. CommandFunction = (function(Context)
  109. if #Context.Arguments == 2 then
  110. local Gear
  111. for _,v in ipairs(game.ServerStorage:GetChildren()) do
  112. if v:IsA("Tool") then
  113. if string.lower(string.sub(v.Name,1,#Context.Arguments[2])) == string.lower(Context.Arguments[2]) then
  114. Gear = v
  115. break
  116. end
  117. end
  118. end
  119. if not Gear then
  120. Context.Run.Notification(Context.Player,{
  121. Title = "Invalid Gear";
  122. Text = "Failed to find the gear.";
  123. })
  124. return
  125. end
  126. -- Get players.
  127. local Players = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
  128. if Players then
  129. if #Players >= 1 then
  130. for _,v in ipairs(Players) do
  131. pcall(function()
  132. Gear:Clone().Parent = v.Backpack
  133. end)
  134. end
  135. return
  136. end
  137. end
  138. Context.Run.Notification(Context.Player,{
  139. Title = "Invalid Player(s)";
  140. Text = "Failed to give gears."
  141. })
  142. else
  143. Context.Run.Notification(Context.Player,{
  144. Title = "Invalid Arguments";
  145. Text = "This command requires 2 arguments."
  146. })
  147. end
  148. end);
  149. };
  150.  
  151. {
  152. Name = "kick";
  153. Aliases = {"disconnect"};
  154. MinimumRank = 0;
  155. CommandFunction = (function(Context)
  156. if #Context.Arguments >= 1 then
  157. local Subjects = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
  158. if (Subjects) then
  159. for _,v in ipairs(Subjects) do
  160. if (not AdminSystem[3]) or (Context.Player.RankID.Value > v.RankID.Value) then
  161. -- Kick
  162. v:Kick("You have been kicked by a RedactedRP Game Moderator.\n\nModerator: "..Context.Player.Name)
  163. else
  164. Context.Run.Notification(Context.Player,{
  165. Title = "Unable to kick.";
  166. Text = "You do not have permission to kick "..v.Name..".";
  167. })
  168. end
  169. end
  170. else
  171. Context.Run.Notification(Context.Player,{
  172. Title = "Invalid Expression.";
  173. Text = "Failed."
  174. })
  175. end
  176. else
  177. Context.Run.Notification(Context.Player,{
  178. Title = "Invalid Arguments.";
  179. Text = "At least 1 argument required."
  180. })
  181. end
  182. end)
  183. };
  184.  
  185. {
  186. Name = "evaluateplayer";
  187. Aliases = {"ep"};
  188. MinimumRank = 0;
  189. CommandFunction = (function(Context)
  190. if #Context.Arguments == 1 then
  191. local Destination = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
  192. if (Destination) then
  193. for _,v in ipairs(Destination) do
  194. print(v.Name)
  195. end
  196. else
  197. Context.Run.Notification(Context.Player,{
  198. Title = "Invalid Expression.";
  199. Text = "Failed."
  200. })
  201. end
  202. else
  203. Context.Run.Notification(Context.Player,{
  204. Title = "Invalid Arguments.";
  205. Text = "1 Argument required."
  206. })
  207. end
  208. end);
  209. };
  210.  
  211. {
  212. Name = "alert";
  213. Aliases = {"notification","notify","tell","notice"};
  214. MinimumRank = 0;
  215. CommandFunction = (function(Context)
  216. if #Context.Arguments >= 2 then
  217. local Subjects = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
  218. if (Subjects) then
  219. local Message = table.concat(Context.Arguments," ")
  220. Message = game.Chat:FilterStringForBroadcast(Message, Context.Player)
  221. table.remove(Context.Arguments,1)
  222. for _,v in pairs(Subjects) do
  223. Context.Run.Notification(v,{
  224. Title = "Alert";
  225. Text = Message;
  226. })
  227. end
  228. else
  229. Context.Run.Notification(Context.Player,{
  230. Title = "Invalid Expression.";
  231. Text = "Failed."
  232. })
  233. end
  234. else
  235. Context.Run.Notification(Context.Player,{
  236. Title = "Invalid Arguments.";
  237. Text = "2 Arguments required."
  238. })
  239. end
  240. end);
  241. };
  242.  
  243. {
  244. Name = "view";
  245. Aliases = {"watch","look","camera"};
  246. MinimumRank = 0;
  247. CommandFunction = (function(Context)
  248. if #Context.Arguments == 1 then
  249. local Subjects = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1]) -- Get list of mentioned players.
  250. if (Subjects) then
  251. if #Subjects >= 1 then
  252. Subjects = Subjects[1] --grammar go oof
  253. Context.Run.SetCameraObj(Context.Player, Subjects.Character.Humanoid)
  254. end
  255. else
  256. Context.Run.Notification(Context.Player,{
  257. Title = "Invalid Expression.";
  258. Text = "Failed."
  259. })
  260. end
  261. else
  262. Context.Run.Notification(Context.Player,{
  263. Title = "Invalid Arguments.";
  264. Text = "1 Argument required."
  265. })
  266. end
  267. end);
  268. };
  269.  
  270. {
  271. Name = "unview";
  272. Aliases = {"rv","unwatch"};
  273. MinimumRank = 0;
  274. CommandFunction = (function(Context)
  275. Context.Run.SetCameraObj(Context.Player)
  276. end);
  277. };
  278.  
  279. {
  280. Name = "mod";
  281. Aliases = {"moderator","setmod"};
  282. MinimumRank = 0;
  283. CommandFunction = (function(Context)
  284. if #Context.Arguments == 2 then
  285. local Subjects = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
  286. if (Subjects) then
  287. if #Subjects == 1 then
  288. Subjects = Subjects[1]
  289. if (Context.PlayerRank > Subjects.RankID.Value) then
  290. local RankID, RankName
  291. for i,v in pairs(require(game.ReplicatedStorage:WaitForChild("Settings"))[2]) do
  292. if string.lower(string.sub(v,1,#Context.Arguments[2])) == string.lower(Context.Arguments[2]) then
  293. RankID = i
  294. RankName = v
  295. end
  296. end
  297. if RankID and RankName then
  298. if Context.PlayerRank > RankID then
  299. -- Player has higher rank then destination rank.
  300. Subjects.RankID.Value = RankID
  301. Context.Run.Notification(Context.Player,{
  302. Title = "Ranked Player";
  303. Text = "Set the players rank.";
  304. })
  305. Context.Run.Notification(Subjects,{
  306. Title = "Ranked";
  307. Text = "You've been ranked by "..Context.Player.Name..".";
  308. })
  309. else
  310. Context.Run.Notification(Context.Player,{
  311. Title = "Unauthorised";
  312. Text = "You must be higher then then the rank you want to set.";
  313. })
  314. end
  315. else
  316. Context.Run.Notification(Context.Player,{
  317. Title = "Error";
  318. Text = "Invalid Rank.";
  319. })
  320. end
  321. else
  322. Context.Run.Notification(Context.Player,{
  323. Title = "Unauthorised";
  324. Text = "You do not have permission to rank this user.";
  325. })
  326. end
  327. else
  328. Context.Run.Notification(Context.Player,{
  329. Title = "Unauthorised Usage";
  330. Text = "You provided two high, or little players.";
  331. })
  332. end
  333. else
  334. Context.Run.Notification(Context.Player,{
  335. Title = "Invalid Expression.";
  336. Text = "Failed."
  337. })
  338. end
  339. else
  340. Context.Run.Notification(Context.Player,{
  341. Title = "Invalid Arguments.";
  342. Text = "2 Arguments required."
  343. })
  344. end
  345. end)
  346. };
  347.  
  348. {
  349. Name = "unmod";
  350. Aliases = {"unmoderator","unsetmod"};
  351. MinimumRank = 0;
  352. CommandFunction = (function(Context)
  353. if #Context.Arguments == 1 then
  354. local Subjects = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
  355. if (Subjects) then
  356. if #Subjects == 1 then
  357. Subjects = Subjects[1]
  358. if (Context.PlayerRank > Subjects.RankID.Value) then
  359. -- Player has higher rank then destination rank.
  360. Subjects.RankID.Value = 0
  361. Context.Run.Notification(Context.Player,{
  362. Title = "Unranked Player";
  363. Text = "Reset the players rank to guest.";
  364. })
  365. Context.Run.Notification(Subjects,{
  366. Title = "Unranked";
  367. Text = "You've been unranked by "..Context.Player.Name..".";
  368. })
  369. else
  370. Context.Run.Notification(Context.Player,{
  371. Title = "Unauthorised";
  372. Text = "You do not have permission to rank this user.";
  373. })
  374. end
  375. else
  376. Context.Run.Notification(Context.Player,{
  377. Title = "Unauthorised Usage";
  378. Text = "You provided two high, or little players.";
  379. })
  380. end
  381. else
  382. Context.Run.Notification(Context.Player,{
  383. Title = "Invalid Expression.";
  384. Text = "Failed."
  385. })
  386. end
  387. else
  388. Context.Run.Notification(Context.Player,{
  389. Title = "Invalid Arguments.";
  390. Text = "2 Arguments required."
  391. })
  392. end
  393. end)
  394. };
  395.  
  396. {
  397. Name = "respawn";
  398. Aliases = {"re","loadcharacter","lc"};
  399. MinimumRank = 0;
  400. CommandFunction = (function(Context)
  401. if #Context.Arguments == 1 then
  402. local Subjects = Context.Run.GetPlayersFromString(Context.Player, Context.Arguments[1])
  403. if (Subjects) then
  404. table.remove(Context.Arguments,1)
  405. for _,v in pairs(Subjects) do
  406. pcall(function()
  407. v:LoadCharacter()
  408. end)
  409. end
  410. else
  411. Context.Run.Notification(Context.Player,{
  412. Title = "Invalid Expression.";
  413. Text = "Failed."
  414. })
  415. end
  416. else
  417. Context.Run.Notification(Context.Player,{
  418. Title = "Invalid Arguments.";
  419. Text = "1 Argument required."
  420. })
  421. end
  422. end);
  423. };
  424.  
  425. {
  426. Name = "message";
  427. Aliases = {"m"};
  428. MinimumRank = 0;
  429. CommandFunction = (function(Context)
  430. if #Context.Arguments ~= 0 then
  431. local Message = table.concat(Context.Arguments," ")
  432. Message = game.Chat:FilterStringForBroadcast(Message, Context.Player)
  433. game.ReplicatedStorage:WaitForChild("Events").Message:FireAllClients({
  434. Title = "Message";
  435. Text = Message;
  436. From = "From: "..Context.Player.Name
  437. })
  438. else
  439. Context.Run.Notification(Context.Player,{
  440. Title = "Error";
  441. Text = "Please provide text to send."
  442. })
  443. end
  444. end);
  445. };
  446.  
  447. {
  448. Name = "globalmessage";
  449. Aliases = {"gm"};
  450. MinimumRank = 0;
  451. CommandFunction = (function(Context)
  452. if #Context.Arguments ~= 0 then
  453. local http = game:GetService("HttpService")
  454. local messagingService = game:GetService("MessagingService")
  455. local Message = table.concat(Context.Arguments," ")
  456. Message = game.Chat:FilterStringForBroadcast(Message, Context.Player)
  457. local encoded = http:JSONEncode({
  458. Key = "GlobalMessage";
  459. Paramaters = {
  460. Text = Message;
  461. From = Context.Player.Name;
  462. };
  463. })
  464. print(encoded)
  465. messagingService:PublishAsync("GlobalCommands_ADMINSYSTEM_REDACTED", encoded)
  466. else
  467. Context.Run.Notification(Context.Player,{
  468. Title = "Error";
  469. Text = "Please provide text to send."
  470. })
  471. end
  472. end);
  473. };
  474.  
  475. {
  476. Name = "rank";
  477. Aliases = {};
  478. MinimumRank = 0;
  479. CommandFunction = (function(Context)
  480. local Name = require(game.ReplicatedStorage:WaitForChild("Settings"))[2][Context.PlayerRank]
  481. Context.Run.Notification(Context.Player,{
  482. Title = Name;
  483. Text = tostring(Context.PlayerRank);
  484. })
  485. end);
  486. };
  487.  
  488. {
  489. Name = "amongus";
  490. Aliases = {"sus"};
  491. MinimumRank = 0;
  492. CommandFunction = (function(Context)
  493. workspace["Among us Meme guy"].Transparency = 0
  494. workspace["amongus ding ding ding"]:Play()
  495. Context.Player.RankID = 2
  496. wait(10)
  497. workspace["amongus ding ding ding"]:Stop()
  498. workspace["Among us Meme guy"].Transparency = 1
  499. end);
  500. }
  501. }
  502.  
  503.  
  504.  
Advertisement
Add Comment
Please, Sign In to add comment