Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1.  
  2. AddCSLuaFile( "cl_init.lua" )
  3. AddCSLuaFile( "shared.lua" )
  4. include('shared.lua')
  5.  
  6. MixRange = 150;
  7.  
  8. function ENT:Initialize()
  9. self:SetModel("models/props_wasteland/interior_fence002e.mdl")
  10. self.Entity:PhysicsInit( SOLID_VPHYSICS )
  11. self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
  12. self.Entity:SetSolid( SOLID_VPHYSICS )
  13. self.Entity:SetUseType( SIMPLE_USE )
  14.  
  15. self.Entity:GetPhysicsObject():Wake();
  16. end
  17.  
  18. function ENT:Use( activator, caller )
  19. if !activator:IsPlayer() then return false; end
  20. if self.Entity:GetTable().Tapped and self.Entity:GetTable().Tapped > CurTime() then return false; end
  21.  
  22. if (self:GetTable().Owner == activator) then
  23. activator:GiveItem(81, 1, true);
  24. self.Tapped = CurTime() + 5
  25. self:Remove()
  26. end
  27. end
  28.  
  29. function ENT:SetItemOwner ( Owner )
  30. self:GetTable().Owner = Owner;
  31. end
  32.  
  33. local weapons = {"weapon_perp_ak472", "weapon_perp_copgun", "weapon_perp_copgun_ss", "weapon_perp_copgun_usp", "weapon_perp_deagle2", "weapon_perp_fiveseven", "weapon_perp_glock", "weapon_perp_shotgun", "weapon_perp_uzi", "weapon_perp_mp5", "weapon_perp_m4a1", "weapon_perp_para", "weapon_perp_scout", "weapon_perp_lockpick", "weapon_perp_molotov"}
  34.  
  35. function ENT:Think ( )
  36. if (self.goingOff && (self.goingOff + 5) > CurTime()) then return end
  37.  
  38. local min = self:OBBMins()
  39. local cen = self:OBBCenter()
  40. local real = self:LocalToWorld(Vector(cen.x, cen.y, min.z))
  41.  
  42. for _, each in pairs(player.GetAll()) do
  43. if (each:GetPos():Distance(real) < 50) then
  44. local foundGun = false
  45. for _, each in pairs(each:GetWeapons()) do
  46. local cl = string.lower(each:GetClass())
  47.  
  48. for _, class in pairs(weapons) do
  49. if (cl == class) then
  50. foundGun = true
  51. break
  52. end
  53. end
  54.  
  55. if (foundGun) then break end
  56. end
  57.  
  58. if (foundGun) then
  59. self.goingOff = CurTime()
  60. umsg.Start("perp_metal_det")
  61. umsg.Entity(self)
  62. umsg.End()
  63. return
  64. end
  65. end
  66. end
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement