Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------------------------- // DSS Functions
- local DataStoreService = game:GetService("DataStoreService")
- function SetData(Store,Player,Data)
- while true do
- local S, R = pcall(function()
- local NewStore = DataStoreService:GetDataStore(Store)
- NewStore:SetAsync(Player,Data)
- end)
- if S then
- print("Set Data")
- break
- else
- print("DSS Error:")
- print(R)
- wait(2)
- end
- end
- end
- function UpData(Store,Player,Data)
- while true do
- local S, R = pcall(function()
- local NewStore = DataStoreService:GetDataStore(Store)
- NewStore:UpdateAsync(Player,Data)
- end)
- if S then
- break
- else
- print("DSS Error:")
- print(R)
- wait(2)
- end
- end
- end
- function GetData(Store,Player)
- local Result
- while true do
- local S, R = pcall(function()
- local NewStore = DataStoreService:GetDataStore(Store)
- Result = NewStore:GetAsync(Player)
- end)
- if S then
- return Result
- else
- print("DSS Error:")
- print(R)
- wait(2)
- end
- end
- end
- function RemoveData(Store,Player)
- while true do
- local S, R = pcall(function()
- local NewStore = DataStoreService:GetDataStore(Store)
- NewStore:RemoveAsync(Player)
- end)
- if S then
- print("Removed Data")
- break
- else
- print("DSS Error:")
- print(R)
- wait(2)
- end
- end
- end
- function CheckForExistingData(Store,Player)
- local Data = GetData(Store,Player)
- if Data == nil then
- local Result = false
- return Result
- else
- local Result = true
- return Result
- end
- end
- function CreateListing(Store,Data)
- while true do
- local S, R = pcall(function()
- local EntryCount = GetData(Store .. "EntryCount","EntryCount")
- if tonumber(EntryCount) == nil then
- EntryCount = 0
- end
- EntryCount = tostring(tonumber(EntryCount) + 1)
- SetData(Store,EntryCount,Data)
- SetData(Store .. "EntryCount","EntryCount",EntryCount)
- end)
- if S then
- break
- else
- print("DSS Error:")
- print(R)
- wait(2)
- end
- end
- end
- function GetListings(Store)
- local StoreNames
- while true do
- local S, R = pcall(function()
- local EntryCount = GetData(Store .. "EntryCount","EntryCount")
- EntryCount = tonumber(EntryCount)
- StoreNames = {}
- for i = 1, EntryCount do
- local Name = tostring(i)
- local Check = CheckForExistingData(Store,tostring(i))
- if Check == true then
- table.insert(StoreNames,Name)
- end
- end
- end)
- if S then
- return StoreNames
- else
- print("DSS Error:")
- print(R)
- wait(2)
- end
- end
- end
- function RemoveListing(Store,Number)
- SetData(Store,Number,nil)
- end
- function GetEntryCount(Store)
- local EntryCount = GetData(Store .. "EntryCount","EntryCount")
- EntryCount = tonumber(EntryCount)
- return EntryCount
- end
- ----------------------------------------------------------------------- // End Of DSS Functions
- ----------------------------------------------------------------------- // Time And Date Module
- local TimeDateMod = require(script.TimeAndDate)
- game.Players.PlayerAdded:Connect(function(Player)
- ------------------------------------------------------------------- // Perm Ban
- if CheckForExistingData("Bans",Player.Name) == true then
- local Reason = GetData("Bans",Player.Name)
- Player:Kick("You Have Been Permentantly Banned. Reason: " .. Reason)
- end
- ------------------------------------------------------------------- // Temp Ban
- if CheckForExistingData("TempBans",Player.Name) == true then
- local EndTime = GetData("TempBans",Player.Name)
- local CurrentTime = TimeDateMod.UTCTime() -- {Time,Year,Month,Day,Hour,Minute,Sec}
- EndTime = string.split(EndTime,":")
- local StillBanned
- for i = 1,#EndTime do
- if CurrentTime[i] > EndTime[i] then
- StillBanned = true
- end
- end
- if StillBanned == true then
- for i = 2,#EndTime do
- EndTime[i] = EndTime[i] - CurrentTime[i]
- end
- Player:Kick("You Have Been Temp Banned For Another: \n" .. EndTime[2] .. "Years, " ..EndTime[3] .. "Months, " .. EndTime[4] .. "Days, " .. EndTime[5] .. "Hours, " .. EndTime[6] .. "Minutes, " .. EndTime[7] .. "Seconds.")
- end
- if StillBanned == nil then
- RemoveData("TempBans",Player.Name)
- end
- end
- ------------------------------------------------------------------- // Admin Ban Section
- if Player.Name == "minimic2002" then
- Player.Chatted:Connect(function(Msg)
- local Split = string.split(Msg," ")
- ----------------------------------------------------------- // Perm Ban
- if string.lower(Split[1]) == string.lower(":Ban") then
- local Players = game.Players:GetPlayers()
- for i = 1,#Players do
- if string.sub(1,#string.lower(Split[2])) == string.lower(Split[2]) then
- if Split[3] == nil then
- SetData("Bans",Players[i].Name,"You Have Been Banned For Life")
- else
- SetData("Bans",Players[i].Name,Split[3])
- end
- end
- end
- end
- ----------------------------------------------------------- // Temp Ban
- if string.lower(Split[1]) == string.lower(":TempBan") then
- local Players = game.Players:GetPlayers()
- for i = 1,#Players do
- if string.sub(1,#string.lower(Split[2])) == string.lower(Split[2]) then
- if Split[3] == nil then
- local BannedTime = TimeDateMod.UTCTime()
- for i = 1,#BannedTime do
- if i == 4 then
- BannedTime[i] = BannedTime[i] + 1
- end
- end
- SetData("Bans",Players[i].Name,"You Have Been Temp Banned")
- Players[i]:Kick("You Have Been Temp Banned")
- else
- SetData("Bans",Players[i].Name,Split[3])
- end
- end
- end
- end
- -------------------------------------------------------------
- end)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement