Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local DataStoreService = game:GetService("DataStoreService")
- local BanDataStore = DataStoreService:GetDataStore("BanDataStore")
- local saver = DataStoreService:GetDataStore("SaveLeaderstats")
- local Players = game:GetService("Players")
- local admins = {
- 1510746477,
- 66974967,
- 1902509209,
- 2892992107,
- 1193592242,
- 4611035432,
- 3449225478,
- 2766812079,
- 127757866
- }
- game.ReplicatedStorage.AdminEvents.KickPlayer.OnServerEvent:Connect(function(sender,player,reason)
- if table.find(admins,sender.UserId) then
- if game.Players:FindFirstChild(player) then
- if reason ~= "" then
- game.Players:FindFirstChild(player):Kick(reason)
- else
- game.Players:FindFirstChild(player):Kick()
- end
- end
- else
- sender:Kick("Suspected of exploiting")
- end
- end)
- game.ReplicatedStorage.AdminEvents.StealStuff.OnServerEvent:Connect(function(sender,playerName,val)
- if table.find(admins,sender.UserId) then
- if game.Players:FindFirstChild(playerName) then
- local playerToStealFrom = game.Players:FindFirstChild(playerName)
- local value = playerToStealFrom.Loadout:FindFirstChild(val)
- value.Parent = sender.Loadout
- game.ReplicatedStorage.AdminEvents.StealStuff:FireClient(sender)
- end
- else
- sender:Kick("Suspected of exploiting")
- end
- end)
- game.ReplicatedStorage.AdminEvents.BanPlayer.OnServerEvent:Connect(function(sender,victim,days,reason)
- local timeOfUnban = "nil"
- if table.find(admins,sender.UserId) then
- if days ~= nil then
- local currentTime = os.time()
- timeOfUnban = currentTime+86400*days
- end
- if reason ~= "nil" then
- reason = " for "..reason
- else
- reason = ""
- end
- pcall(function()
- BanDataStore:SetAsync(game.Players:GetUserIdFromNameAsync(victim).."-time",timeOfUnban)
- BanDataStore:SetAsync(game.Players:GetUserIdFromNameAsync(victim).."-reason",reason)
- end)
- local playerToBan = game.Players:FindFirstChild(victim)
- if playerToBan then
- if timeOfUnban == "nil" then
- playerToBan:Kick("You have been permanently banned"..reason..".")
- else
- playerToBan:Kick("You have been temporarily banned"..reason..". Your ban will be lifted at "..os.date("%H",timeOfUnban)..":"..os.date("%M",timeOfUnban).." on "..os.date("%d",timeOfUnban).." "..os.date("%B",timeOfUnban).." "..os.date("%Y",timeOfUnban))
- end
- end
- else
- sender:Kick("Suspected of exploiting")
- end
- end)
- game.ReplicatedStorage.AdminEvents.GiveStuff.OnServerEvent:Connect(function(sender,recipientId,items)
- if table.find(admins,sender.UserId) then
- saver:SetAsync(recipientId.."-GiveLog",items)
- else
- sender:Kick("Suspected of exploiting")
- end
- end)
- game.Players.PlayerAdded:Connect(function(player)
- local reason = nil
- local timeOfUnban = nil
- pcall(function()
- reason = BanDataStore:GetAsync(player.UserId.."-reason")
- timeOfUnban = BanDataStore:GetAsync(player.UserId.."-time")
- print(reason,timeOfUnban)
- end)
- if reason == nil and timeOfUnban == nil then return end
- if reason == "nil" then
- reason = ""
- end
- if timeOfUnban == "nil" then
- player:Kick("You have been permanently banned"..reason..".")
- elseif timeOfUnban<os.time() then
- BanDataStore:RemoveAsync(player.UserId.."-time")
- BanDataStore:RemoveAsync(player.UserId.."-reason")
- else
- player:Kick("You have been temporarily banned"..reason..". Your ban will be lifted at "..os.date("%H",timeOfUnban)..":"..os.date("%M",timeOfUnban).." on "..os.date("%d",timeOfUnban).." "..os.date("%B",timeOfUnban).." "..os.date("%Y",timeOfUnban))
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement