Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Iaying
- local DataStoreService = game:GetService("DataStoreService")
- local HttpService = game:GetService("HttpService")
- local Players = game:GetService("Players")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local SoundService = game:GetService("SoundService")
- local StarterGui = game:GetService("StarterGui")
- local TextService = game:GetService("TextService")
- local Commands = require(script:WaitForChild("Commands", nil))
- local BanList = DataStoreService:GetDataStore("BanlistNew", "global")
- local TimedBanlist = DataStoreService:GetDataStore("TimedBanlist","global")
- local PlaceInfoStore = DataStoreService:GetOrderedDataStore("RetrobloxPlaceInfoStore")
- local WarnPlayerRemote = ReplicatedStorage.RemoteEvents.WarnPlayer
- local AdminNotifyRemote = ReplicatedStorage.RemoteEvents.AdminNotifyPlayer
- local ReportCooldown = true
- local function AddPlayer(player)
- local success,info = pcall(function()
- return BanList:GetAsync(player.UserId)
- end)
- --loops until it can successfully get data
- while not success do
- wait()
- success,info = pcall(function()
- return BanList:GetAsync(player.UserId)
- end)
- end
- local Result
- local Success, Err = pcall(function()
- Result = TimedBanlist:GetAsync(player.UserId)
- end)
- while not Success do
- Success, Err = pcall(function()
- Result = TimedBanlist:GetAsync(player.UserId)
- end)
- end
- if Result then
- if Result.Expiry < os.time() then
- Success, Err = pcall(function()
- TimedBanlist:RemoveAsync(player.UserId)
- end)
- Result = nil
- end
- end
- if info or Result then
- warn(Result,info)
- --player is banned
- if info then
- if player:GetRankInGroup(5264310) >= 225 and info ~= "AdminAutoUnban_BYPASS" then
- BanList:RemoveAsync(player.UserId)
- elseif player:GetRankInGroup(5264310) >= 226 then
- BanList:RemoveAsync(player.UserId)
- else
- local BanScreen = script:WaitForChild("Ban"):Clone()
- BanScreen.Background.Foreground.ReasonContainer.ModNote.Text = string.format("Moderator Reason: <tag> <b>%s </b></tag>",info)
- BanScreen.Parent = player.PlayerGui
- ReplicatedStorage:ClearAllChildren()
- StarterGui:ClearAllChildren()
- SoundService:ClearAllChildren()
- workspace:ClearAllChildren()
- --player:Kick("You have been banned from RetroStudio \n Reason: "..info)
- end
- elseif Result then
- if player:GetRankInGroup(5264310) >= 225 then
- BanList:RemoveAsync(player.UserId)
- else
- local BanScreen = script:WaitForChild("Ban"):Clone()
- BanScreen.Background.Foreground.Reviewed_Text.Visible = true
- BanScreen.Background.Foreground.ReasonContainer.ModNote.Text = string.format("Moderator Reason: <tag> <b>%s </b></tag>",Result.Reason)
- BanScreen.Background.Foreground.Reviewed_Text.Text = os.date("Reviewed: <tag><b>%x %I:%M %p %Z</b></tag>",Result.TimeOfBan)
- if Result.Expiry > (os.time() + 157784760) then
- --User's banned for man than 5 years, treat it like a termination
- else
- BanScreen.Background.Foreground.AccountDeleted_Text.Text = "Account Banned"
- BanScreen.Background.Foreground.AccountTerminated_Text.Text = os.date("Your account has been banned. You may re-activate it after <tag><b>%x %I:%M %p %Z. </b></tag>",Result.Expiry)
- end
- BanScreen.Parent = player.PlayerGui
- ReplicatedStorage:ClearAllChildren()
- StarterGui:ClearAllChildren()
- SoundService:ClearAllChildren()
- workspace:ClearAllChildren()
- end
- end
- else
- --player is not banned
- --CharacterAutoLoads off, meaning GUI doesnt load either.
- for _,guiObject in pairs(StarterGui:GetChildren()) do
- guiObject:Clone().Parent = player:WaitForChild("PlayerGui")
- end
- end
- end
- Players.PlayerAdded:Connect(AddPlayer)
- for _,v in pairs(Players:GetPlayers()) do
- AddPlayer(v)
- end
- ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("AdminCommands").OnServerEvent:Connect(function(player,cmd,p1,p2)
- AdminNotifyRemote:FireClient(player, "Recieved admin command request, please wait...")
- if player:GetRankInGroup(5264310) >= 225 then
- local success, data = pcall(function()
- return Commands[cmd](player.UserId,p1,p2)
- end)
- if success then
- AdminNotifyRemote:FireClient(player, data)
- else
- AdminNotifyRemote:FireClient(player, "There was an error performing this command")
- warn("Error trying admin command.")
- end
- else
- AdminNotifyRemote:FireClient(player, "Invalid permissions")
- end
- end)
- -- For admin commands that need to return stuff
- ReplicatedStorage.RemoteFunctions.AdminCommands.OnServerInvoke = function(player,command,p1,p2)
- if player:GetRankInGroup(5264310) >= 225 then
- local success, data = pcall(function()
- return Commands[command](player.UserId,p1,p2)
- end)
- if success then
- return data
- else
- warn("Error trying admin command.")
- end
- end
- end
- ReplicatedStorage.RemoteEvents.PlaceReportRequested.OnServerEvent:Connect(function(player, placeid, reason)
- if ReportCooldown then
- ReportCooldown = false
- local reportData = {
- ["content"] = "",
- ["embeds"] = {{
- ["title"] = "**PLACE REPORT**",
- ["description"] = "Report sent by "..player.Name.." ("..player.UserId..")",
- ["type"] = "rich",
- ["color"] = tonumber(0x0088ff),
- ["fields"] = {
- {
- ["name"] = "Reported Place ID:",
- ["value"] = placeid,
- ["inline"] = false
- },
- {
- ["name"] = "Reason:",
- ["value"] = reason,
- ["inline"] = false
- }
- }
- }}
- }
- reportData = HttpService:JSONEncode(reportData)
- HttpService:PostAsync("https://discordapp.com/api/webhooks/776649513645375499/dzhmt0ei4xFlXV3VUSJ775xxphi0mVj4MtUuqwbMMqL4lzvtW0G__oPDnOihZ8WZBa4z", reportData)
- wait(10)
- ReportCooldown = true
- else
- WarnPlayerRemote:FireClient(player, "Sending reports too fast, please wait a few seconds and try again.")
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement