Guest User

Untitled

a guest
Oct 17th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. local MaxCorner = Vector(-15348,-15351,-10^9)    
  2. local MinCorner = Vector(-3848,-9886,2000)    
  3.        
  4. if SERVER then
  5.         AddCSLuaFile("pureacf_init")
  6.  
  7.         print("Sending PureACF Lua's to Clients")
  8.        
  9.         concommand.Add("pureacf_removehooks",function()
  10.                 hook.Remove("PlayerNoClip","pureacf_noclip")
  11.                 hook.Remove("Think","pureacf_unclip")
  12.                 print("Removing Hooks.....")
  13.         end)
  14.        
  15. end    
  16.  
  17.  
  18.  
  19. function InRange(vec, minCorner, maxCorner)
  20.  
  21.         if vec.x > minCorner.x then return false end
  22.         if vec.y > minCorner.y then return false end
  23.         if vec.z > minCorner.z then return false end
  24.  
  25.         if vec.x < maxCorner.x then return false end
  26.         if vec.y < maxCorner.y then return false end
  27.         if vec.z < maxCorner.z then return false end
  28.  
  29.  
  30.         return true
  31. end
  32.  
  33. hook.Add( "PlayerNoClip", "pureacf_noclip", function( ply )
  34.    
  35.  
  36.         if not InRange( ply:GetPos(), MinCorner, MaxCorner ) then
  37.                 ply:ChatPrint("You Can Only NoClip In The Safe Zone!")
  38.                 return false
  39.         end
  40. end )
  41.  
  42.  
  43. if SERVER then
  44.  
  45.         hook.Add( "Think", "pureacf_unclip", function()
  46.        
  47.                 local plys = player.GetAll()
  48.  
  49.                 for _,ply in pairs(plys) do
  50.  
  51.             if not ply:IsSuperAdmin() or not ply:IsAdmin() then
  52.  
  53.                             if ply:GetMoveType() == MOVETYPE_NOCLIP then
  54.  
  55.                                     if not InRange( ply:GetPos(), MinCorner, MaxCorner ) then
  56.                                             ply:SetMoveType( MOVETYPE_WALK )
  57.                                             ply:ChatPrint("You Can Only NoClip In The Safe Zone!")
  58.                                     end
  59.                             end
  60.             end
  61.                 end
  62.         end)
  63.  
  64. end
Add Comment
Please, Sign In to add comment