Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. local ban = {}
  2.  
  3. local players   = game:GetService("Players")
  4. local dataStore = game:GetService("DataStoreService")
  5. local bans      = dataStore:GetDataStore("bans5")
  6.  
  7. function ban.checkPlayer(player)
  8.     local banned = bans:GetAsync(player.UserId)
  9.     if banned then
  10.         local reason,TIME = banned[1],banned[2]
  11.         if TIME and TIME < os.time() then
  12.             return false,'User surpassed ban length'
  13.         elseif TIME then
  14.             player:Kick("You are banned! reason: "..reason.." For: ("..((TIME-os.time())/60).." minutes)")
  15.         else
  16.             player:Kick("You are banned! reason: "..reason.." (permanently)")
  17.         end
  18.     end
  19. end
  20.  
  21. function ban.applyBan(ID,reason,TIME)
  22.     if TIME then
  23.         TIME = (TIME*60) + os.time()
  24.     else
  25.         TIME = false
  26.     end
  27.     bans:SetAsync(ID,{reason,TIME})
  28. end
  29.  
  30. return ban
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement