if( SERVER ) then AddCSLuaFile( "shared.lua" );endif( 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 serverSWEP.Author = "Anders Munk"SWEP.Instructions = "Left click to attempt to pick the lock"SWEP.Contact = ""SWEP.Purpose = ""SWEP.ViewModelFOV = 62SWEP.ViewModelFlip = falseSWEP.AnimPrefix = "rpg"SWEP.Spawnable = falseSWEP.AdminSpawnable = trueSWEP.Sound = "doors/door_latch3.wav";SWEP.Primary.ClipSize = -1 // Size of a clipSWEP.Primary.DefaultClip = 0 // Default number of bullets in a clipSWEP.Primary.Automatic = true // Automatic/Semi AutoSWEP.Primary.Ammo = ""SWEP.Secondary.ClipSize = -1 // Size of a clipSWEP.Secondary.DefaultClip = 0 // Default number of bullets in a clipSWEP.Secondary.Automatic = false // Automatic/Semi AutoSWEP.Secondary.Ammo = ""/*--------------------------------------------------------- Name: SWEP:Initialize( ) Desc: Called when the weapon is first loaded---------------------------------------------------------*/function SWEP:Initialize() if( SERVER ) then self:SetWeaponHoldType( "normal" ); endend/*--------------------------------------------------------- Name: SWEP:Precache( ) Desc: Use this function to precache stuff---------------------------------------------------------*/function SWEP:Precache() util.PrecacheSound( self.Sound )endfunction SWEP:Deploy() if( SERVER ) then self.Owner:DrawViewModel( false ); self.Owner:DrawWorldModel( false ); endend/*--------------------------------------------------------- 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 ); endend /*--------------------------------------------------------- SecondaryAttack ---------------------------------------------------------*/ function SWEP:SecondaryAttack() end