Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local log = {}
- local cd = {}
- local i = 1
- local testing = false
- local cooldown = 1
- local ids = {}
- local ids2 = {}
- local bypass = {}
- local tester = {}
- local folder = script.Resources
- local storage = game:GetService('ReplicatedStorage')
- local arrestFolder = storage:FindFirstChild('ArrestFolder')
- local function checkPlayer(player)
- local p = game.Players:FindFirstChild(player) ----
- for _,v in pairs(ids)do
- if p:IsInGroup(v) then
- if p:GetRankInGroup(v) >= 3 then
- return true
- end
- else
- for _,d in pairs(bypass)do
- if d == p.UserId then
- return true
- end
- end
- end
- end
- for _,v in pairs(ids2)do
- if p:IsInGroup(v)then
- if p:GetRankInGroup(v) >= 14 then
- return true
- end
- end
- end
- if testing then
- for _,v in pairs(tester)do
- if v == p.UserId then
- return true
- end
- end
- end
- end
- local function findPrisonedPlayer(target)
- for _,v in pairs(arrestFolder:GetChildren())do
- if string.match(v.Name:sub(1, target:len()):lower(), (target:lower()))then
- print('Unjailing Player: '..v.Name)
- return v.Name
- end
- end
- end
- local function findPlayer(target)
- for _, players in pairs(game.Players:GetChildren()) do
- if string.match(players.Name:sub(1, target:len()):lower(), (target:lower())) then
- print('Found Player: '..players.Name)
- return players
- end
- end
- end
- local function checkCD(sender)
- for i,v in pairs(cd)do
- for a,b in pairs(v)do
- if b == sender then
- return true
- end
- end
- end
- end
- local function unjailPlayer(player)
- local tag = arrestFolder:FindFirstChild(player)
- tag:Destroy()
- end
- local function jailPlayer(player, duration, reason, sender, team)
- if arrestFolder:FindFirstChild(player) then return end
- if checkPlayer(player) then return end -----
- if checkCD(sender) then return end
- local tag = folder.PName:Clone()
- log[#log+1] = {
- ['Player'] = player,
- ['Duration'] = duration,
- ['Reason'] = reason,
- ['Sender'] = sender,
- ['Team'] = team
- }
- cd[#cd+1] = {
- ['Player'] = sender,
- ['CoolDown'] = cooldown,
- }
- tag.Name = player
- tag.Value = player
- tag.Reason.Value = reason
- tag.Time.Value = duration*60
- tag.Sentence.Value = duration*60
- tag.Parent = arrestFolder
- tag.Team.Value = team
- tag.Sender.Value = sender
- game.Players[player].Team = game.Teams.Prison
- game.Players[player]:LoadCharacter()
- for i,v in pairs(log)do
- for c,d in pairs(log[i])do
- end
- end
- end
- local cmd1 = ';jail '
- local cmd2 = ';unjail '
- local cmd3 = ';plog'
- local function checkCommand(msg, sender)
- if msg:sub(1, cmd1:len()):lower()== cmd1:lower() then
- local mainstring = msg:sub(cmd1:len() + 1)
- local split = string.split(mainstring, ', ')
- if split[2] == ' ' or nil then return end
- local duration = split[2]
- local playername = split[1]
- local reason = split[3]
- local findplayer = findPlayer(playername)
- local player = game.Players:FindFirstChild(findplayer.Name)
- local team = game.Players:FindFirstChild(findplayer.Name).Team.Name
- jailPlayer(player.Name, duration, reason, sender.Name, team) -----
- end
- if msg:sub(1, cmd2:len()):lower() == cmd2:lower() then
- local playername = msg:sub(cmd2:len() + 1)
- local playertag = findPrisonedPlayer(playername)
- unjailPlayer(playertag)
- end
- if msg:sub(1, cmd3:len()):lower()== cmd3:lower() then
- end
- end
- local function inGame(player)
- if game.Players:FindFirstChild(player)then
- return true
- end
- end
- local function inPrison(player)
- if inGame(player) then
- local prisonarea = game.Workspace.PrisonAreas.PrisonArea
- local char = game.Workspace:FindFirstChild(player)
- if (char.HumanoidRootPart.Position - prisonarea.Position).Magnitude < 55 then
- return true
- end
- end
- end
- local ui = script.Arrest
- game.Players.PlayerAdded:Connect(function(player)
- repeat wait()
- until player.Character
- if checkPlayer(player.Name) then
- local clone = ui:Clone()
- clone.Parent = player.PlayerGui
- player.Chatted:Connect(function(msg)
- checkCommand(msg, player) ----
- end)
- end
- if arrestFolder:FindFirstChild(player.Name) then
- player.Team = game.Teams.Prison
- player:LoadCharacter()
- end
- end)
- spawn(function()
- while true do
- wait(1)
- for i,v in pairs(arrestFolder:GetChildren())do
- v.Time.Value = v.Time.Value-1
- if v.Time.Value == 0 then
- unjailPlayer(v.Name)
- v:Destroy()
- end
- end
- end
- end)
- spawn(function()
- while true do
- wait(5)
- for i,v in pairs(game.Players:GetChildren())do
- if arrestFolder:FindFirstChild(v.Name)then
- if v.Team == game.Teams.Prison then
- else
- v.Team = game.Teams.Prison
- v:LoadCharacter()
- end
- else
- if v.Team == game.Teams.Prison then
- if v:IsInGroup(5425370)then
- v.Team = game.Teams.GCR
- else
- v.Team = game.Teams.Civilians
- end
- v:LoadCharacter()
- end
- end
- end
- end
- end)
- spawn(function()
- while true do
- wait(1)
- for i,v in pairs(cd)do
- for a,b in pairs(v)do
- if a == 'CoolDown' then
- cd[i][a] = b-1
- if b == 0 then
- table.remove(cd, i)
- end
- end
- end
- end
- end
- end)
- spawn(function()
- while true do
- wait(2.5)
- for i,v in pairs(arrestFolder:GetChildren())do
- local plyr = v.Name
- if inPrison(v.Name) then
- else
- if inGame(v.Name) then
- local player = game.Players:FindFirstChild(v.Name)
- player:LoadCharacter()
- end
- end
- end
- end
- end)
- game.ReplicatedStorage.ArrestFolder.ChildAdded:Connect(function(tag)
- wait(5)
- local ff = false
- for i,v in pairs(log)do
- if tag.Name == log[i]['Player'] then
- if tag.Reason.Value == log[i]['Reason'] then
- if tag.Sender.Value == log[i]['Sender'] then
- ff = true
- warn('True Prison')
- end
- end
- end
- end
- if ff == false then
- warn('False Prison')
- tag:Destroy()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement