Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.41 KB | None | 0 0
  1. if (SERVER) then
  2. AddCSLuaFile("shared.lua")
  3. SWEP.AutoSwitchTo = true
  4. SWEP.AutoSwitchFrom = true
  5. SWEP.IconLetter = "I"
  6. end
  7. SWEP.HoldType = "shotgun"
  8. if (CLIENT) then
  9. SWEP.DrawAmmo = true
  10. SWEP.ViewModelFOV = 64
  11. SWEP.ViewModelFlip = false
  12. SWEP.CSMuzzleFlashes = false
  13. SWEP.PrintName = "Lockpick"
  14. SWEP.Author = "Jake_1305"
  15. SWEP.Slot = 1
  16. SWEP.SlotPos = 1
  17. SWEP.IconLetter = "C"
  18. end
  19. SWEP.Author = "Jake_1305"
  20.  
  21. SWEP.Spawnable = false
  22. SWEP.AdminSpawnable = true
  23.  
  24. SWEP.ViewModel = "models/weapons/v_crowbar.mdl"
  25. SWEP.WorldModel = "models/weapons/w_crowbar.mdl"
  26.  
  27. SWEP.Primary.Recoil = 0
  28. SWEP.Primary.Damage = -1
  29. SWEP.Primary.NumShots = 1
  30. SWEP.Primary.Cone = 0
  31. SWEP.Primary.Delay = 1.0
  32. SWEP.Primary.ClipSize = -1
  33. SWEP.Primary.DefaultClip = -1
  34.  
  35. SWEP.Primary.ClipSize = 1
  36. SWEP.Primary.DefaultClip = 1
  37. SWEP.Primary.Automatic = false
  38. SWEP.Primary.Ammo = "none"
  39.  
  40. SWEP.Secondary.Recoil = 0
  41. SWEP.Secondary.Damage = -1
  42. SWEP.Secondary.NumShots = 1
  43. SWEP.Secondary.Cone = 0
  44. SWEP.Secondary.Delay = 1.0
  45. SWEP.Secondary.ClipSize = -1
  46. SWEP.Secondary.DefaultClip = -1
  47.  
  48. SWEP.Secondary.ClipSize = -1
  49. SWEP.Secondary.DefaultClip = -1
  50. SWEP.Secondary.Automatic = false
  51. SWEP.Secondary.Ammo = "none"
  52.  
  53. function SWEP:Initialize()
  54. self:SetWeaponHoldType(self.HoldType)
  55. end
  56.  
  57. function SWEP:Deploy()
  58. end
  59.  
  60. function SWEP:Reload()
  61. end
  62.  
  63. function SWEP:Think()
  64. end
  65.  
  66. function SWEP:PrimaryAttack()
  67. local tr = self.Owner:GetEyeTrace()
  68.  
  69. if !tr.Entity:IsDoor() && !tr.Entity:IsPlayer() then return false end
  70.  
  71. local Dist = self.Owner:EyePos():Distance(tr.HitPos)
  72. if Dist > 100 then return false end
  73. if SERVER then
  74. if IsValid(Trace.Entity) && Trace.Entity:IsPlayer() && trace.Entity:GetNWBool("Handcuffed") && self.Owner:HasSkill("skill_picking",3) then
  75. timer.Simple(1,function(self)
  76. trace.Entity:SetNWBool("Handcuffed",false)
  77. self.Owner:EmitSound("ambient/materials/platedrop1.wav",100,100)
  78. --OCRP_Challenge_Gain( ply, "Pro", "handcuff", 25, "Theft" )
  79. end
  80. if tr.Entity:IsDoor() then
  81. if tr.Entity:GetClass() == "func_door" then
  82. if !self.Owner:HasSkill("skill_picking",6) then
  83. self.Weapon:SetNextPrimaryFire(CurTime() + 5)
  84. return
  85. end
  86. end
  87. if tr.Entity:GetClass() == "prop_vechicle_jeep" then
  88. if !self.Owner:HasSkill("skill_picking",6) then
  89. self.Weapon:SetNextPrimaryFire(CurTime() + 5)
  90. return
  91. end
  92. end
  93. if tr.Entity.PadLock != nil && tr.Entity.PadLock:IsValid() then
  94. if !self.Owner:HasSkill("skill_picking",5) then
  95. self.Weapon:SetNextPrimaryFire(CurTime() + 5)
  96. return
  97. else
  98. tr.Entity.PadLock:TakeDamage(100,self.Owner)
  99. end
  100. end
  101. local snd = {1,3,4}
  102. self.Owner:EmitSound("weapons/357/357_reload".. tostring(snd[math.random(1, #snd)]) ..".wav", 100, 100)
  103. --self.Owner:EmitSound("doors/door_locked2.wav",100,100)
  104. timer.Simple(1,function()
  105. local multi = 1
  106. if self.Owner:HasSkill("skill_picking",1) then
  107. if self.Owner:HasSkill("skill_picking",2) then
  108. multi = 1.15
  109. if self.Owner:HasSkill("skill_picking",3) then
  110. if self.Owner:HasSkill("skill_picking",4) then
  111. multi = 1.35
  112. if self.Owner:HasSkill("skill_picking",5) then
  113. if self.Owner:HasSkill("skill_picking",6) then
  114. if self.Owner:HasSkill("skill_picking",7) then
  115. multi = 1.6
  116. end
  117. end
  118. end
  119. end
  120. end
  121. end
  122. end
  123. local Chance = 25 * multi
  124. local Random = math.random( 0, 100 )
  125. if Random > Chance && Random < 60 then
  126. self.Owner:Hint("Your lockpick broke.")
  127. self.Owner:SelectWeapon("weapon_idle_hands_ocrp")
  128. self:Remove()
  129. -- OCRP_Challenge_Gain( ply, "Pro", "break", 5, "Theft" )
  130. elseif Random <= Chance then
  131. tr.Entity:Fire('UnLock')
  132. tr.Entity:SetNWBool("UnLocked",true)
  133. tr.Entity:Fire('Open', '', .5)
  134. self.Owner:EmitSound("doors/door_latch3.wav",100,100)
  135. -- OCRP_Challenge_Gain( ply, "Pro", "door", 20, "Theft" )
  136. else
  137. self.Owner:Hint("Lockpicking Failed")
  138. end
  139. end)
  140. end
  141.  
  142. end
  143. if SERVER then
  144. if OCRP_Has_Permission(self.Owner,tr.Entity) then
  145. if tr.Entity:IsVehicle() and !tr.Entity:IsGovCar() and tr.Entity:GetTable().LastSirenPlay and tr.Entity:GetTable().LastSirenPlay + 23 > CurTime() then
  146. umsg.Start('car_alarm_stop');
  147. umsg.Entity(tr.Entity);
  148. umsg.End();
  149.  
  150. tr.Entity:GetTable().LastSirenPlay = nil;
  151. end
  152. else
  153. if SERVER and tr.Entity:IsVehicle() and (!tr.Entity:GetDriver() or !tr.Entity:GetDriver():IsValid() or !tr.Entity:GetDriver():IsPlayer()) and !tr.Entity:IsGovCar() then
  154. umsg.Start('car_alarm');
  155. umsg.Entity(tr.Entity);
  156. umsg.End();
  157.  
  158. tr.Entity:GetTable().LastSirenPlay = CurTime();
  159.  
  160. end
  161. end
  162. end
  163. self.Weapon:SetNextPrimaryFire(CurTime() + 5)
  164. end
  165.  
  166.  
  167. function SWEP:EmptyClip()
  168. if SERVER then
  169. self.Owner:Hint("Holstering Lockpick, it will take 5 seconds")
  170. timer.Simple(5,function()
  171. if !self.Owner:IsValid() then return end
  172. if self.Owner:HasWeapon("weapon_lockpick_ocrp") && self.Owner:GetActiveWeapon():GetClass() == "weapon_lockpick_ocrp" then
  173. if self.Owner:IsPlayer() then
  174. self.Owner:GiveItem("item_lockpick",1)
  175. self.Owner:StripWeapon("weapon_lockpick_ocrp")
  176. end
  177. end
  178. end)
  179. end
  180. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement