if( SERVER ) then AddCSLuaFile( "shared.lua" ); end if( CLIENT ) then SWEP.PrintName = "Lockpick"; SWEP.Slot = 1; SWEP.SlotPos = 1; SWEP.DrawAmmo = false; SWEP.DrawCrosshair = false; end // Variables that are used on both client and server SWEP.Author = "Anders Munk" SWEP.Instructions = "Left click to attempt to pick the lock" SWEP.Contact = "" SWEP.Purpose = "" SWEP.ViewModelFOV = 62 SWEP.ViewModelFlip = false SWEP.AnimPrefix = "rpg" SWEP.Spawnable = false SWEP.AdminSpawnable = true SWEP.Sound = "doors/door_latch3.wav"; SWEP.Primary.ClipSize = -1 // Size of a clip SWEP.Primary.DefaultClip = 0 // Default number of bullets in a clip SWEP.Primary.Automatic = true // Automatic/Semi Auto SWEP.Primary.Ammo = "" SWEP.Secondary.ClipSize = -1 // Size of a clip SWEP.Secondary.DefaultClip = 0 // Default number of bullets in a clip SWEP.Secondary.Automatic = false // Automatic/Semi Auto SWEP.Secondary.Ammo = "" /*--------------------------------------------------------- Name: SWEP:Initialize( ) Desc: Called when the weapon is first loaded ---------------------------------------------------------*/ function SWEP:Initialize() if( SERVER ) then self:SetWeaponHoldType( "normal" ); end end /*--------------------------------------------------------- Name: SWEP:Precache( ) Desc: Use this function to precache stuff ---------------------------------------------------------*/ function SWEP:Precache() util.PrecacheSound( self.Sound ) end function SWEP:Deploy() if( SERVER ) then self.Owner:DrawViewModel( false ); self.Owner:DrawWorldModel( false ); end end /*--------------------------------------------------------- Name: SWEP:PrimaryAttack( ) Desc: +attack1 has been pressed ---------------------------------------------------------*/ function SWEP:PrimaryAttack() if( CLIENT ) then return; end local trace = self.Owner:GetEyeTrace(); if( not trace.Entity:IsValid() or not trace.Entity:IsOwnable() or self.Owner:EyePos():Distance( trace.Entity:GetPos() ) > 65 ) then return; end if (math.random(1,10) == 5) then trace.Entity:Fire( "unlock", "", 0 ); trace.Entity:SetNWInt("locked", 0) self.Owner:EmitSound( self.Sound ); self.Weapon:SetNextPrimaryFire( CurTime() + 5.0 ); Notify( self.Owner, 1, 3, "You succeded in picking this lock!" ); else Notify( self.Owner, 1, 3, "You failed to pick this lock! Try again" ); self.Weapon:SetNextPrimaryFire( CurTime() + 2.5 ); end end /*--------------------------------------------------------- SecondaryAttack ---------------------------------------------------------*/ function SWEP:SecondaryAttack() end