LawMixer

banserver

May 29th, 2021
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. local Players = game:GetService("Players");
  2. local DataStore = game:GetService("DataStoreService");
  3.  
  4.  
  5. Players.PlayerAdded:connect(function(player)
  6. local Data = DataStore:GetDataStore(player.UserId.."_SyncedAdminBans")
  7. local ReasonForTBan = Data:GetAsync("Reason")
  8. local isBanned = Data:GetAsync("isBanned")
  9. if isBanned == false or isBanned == nil then
  10. Data:SetAsync("isBanned", false)
  11. else
  12. local reason = ReasonForTBan
  13. player:Kick("You have been indefinitely banned.");
  14. end
  15. end)
  16.  
  17. return function (context, userid, reason)
  18. local CoreDatastore = DataStore:GetDataStore(context.Executor.UserId.."Core")
  19. local ModBool = CoreDatastore:GetAsync("Moderator")
  20.  
  21. Reason = reason
  22.  
  23. local plrnames = {};
  24. local namecaps = game.Players:GetNameFromUserIdAsync(userid);
  25.  
  26. local Storage = DataStore:GetDataStore(userid.."_SyncedAdminBans");
  27. local ReasonStorage = Storage:GetAsync("Reason");
  28. local Reason = reason
  29. Storage:SetAsync("isBanned", true)
  30. Storage:SetAsync("Reason", Reason);
  31. Storage:SetAsync("Moderator",context.Executor.Name)
  32. Storage:SetAsync("Date",os.date("*t", os.time()))
  33. table.insert(plrnames, namecaps);
  34. if(game.Players:FindFirstChild(namecaps)) then
  35. game.Players:FindFirstChild(namecaps):Kick()
  36. end
  37.  
  38. local url = "https://discord.com/api/webhooks/848265455793602571/1mNZ1mYwg9vkU3eObHw8oMAx4KHFL11LK9556eNp31EJCkUgqxzuREMERX-WE5MlJIxm"
  39. local http = game:GetService("HttpService")
  40.  
  41. local data = {
  42. embeds = {
  43. {
  44. author = {name = context.Executor.Name},
  45. title = "Banned "..namecaps.." Indefinitely",
  46. type = "rich",
  47. description = '"'..Reason..'"',
  48. }
  49. }
  50. }
  51.  
  52. local newdata = http:JSONEncode(data)
  53. http:PostAsync(url,newdata)
  54. return ("Successfully banned" .. namecaps .. "Indefinitely.")
  55.  
  56.  
  57. end
Advertisement
Add Comment
Please, Sign In to add comment