как добавить прицелв свой swep

0
Посетители
0
Новичок
как добавить прицелв свой swep так, чтобы при нажатии правой кнопки fow уменьшывался и по средине появлялся прицел
структура :
---------------------------------------------------------------------------------
-------------------------------|
--Buzzofwar-- Please do not steal or copy this! I  put much effort and time into perfecting it to make it simple|
---------------------------------------------------------------------------------
-------------------------------|
//General Settings \\
SWEP.AdminSpawnable = true                          -- Is the swep spawnable for admin.
SWEP.ViewModelFOV = 65                            -- How much of the weapon do u see.
SWEP.ViewModel = "models/weapons/Payday2/v_rif_famas2.mdl"     -- The viewModel, the model you se when you are holding it.
SWEP.WorldModel = "models/weapons/w_smg_tmp.mdl"    -- The worlmodel, The model yu when it's down on the ground.
SWEP.ViewModelFlip = true -- If the model should be fliped when you see it.
SWEP.UseHands = false -- Weather the player model should use its hands.
SWEP.AutoSwitchTo = true                            -- when someone walks over the swep, chould i automatectly change to your swep.
SWEP.Slot = 1                                    -- Deside wich slot you want your swep do be in.
SWEP.HoldType = "ar2"                            -- How the swep is hold Pistol smg greanade melee.
SWEP.PrintName = "Para"                          -- your sweps name.
SWEP.Author = "Buzzofwar"                           -- Your name.
SWEP.Spawnable = true                                -- Can everybody spawn this swep.
SWEP.AutoSwitchFrom = false                          -- Does the weapon get changed by other sweps if you pick them up.
SWEP.FiresUnderwater = true                        -- Does your swep fire under water.
SWEP.Weight = 4                                    -- Chose the weight of the Swep.
SWEP.DrawCrosshair = true                            -- Do you want it to have a crosshair.
SWEP.Category = "Payday 2 Sweps"                -- Make your own catogory for the swep.
SWEP.SlotPos = 1                                    -- Deside wich slot you want your swep do be in.
SWEP.DrawAmmo = true                                  -- Does the ammo show up when you are using it.
SWEP.ReloadSound = ""            -- Reload sound.
SWEP.Instructions = ""              -- How do pepole use your swep.
SWEP.Contact = "Buzzofawr"                      -- How Pepole chould contact you.
SWEP.Purpose = ""          -- What is the purpose with this.
SWEP.base = "swep_ironsight_base" -- What base should the swep be based on.
SWEP.SwayScale = .1
SWEP.BobScale = .1
//General settings\\
--------------------------------------------------------------------------------|

SWEP.Base = "swep_ironsight_base"
SWEP.Primary.Ammo          = "smg1"
SWEP.Primary.Sound = "pay/Para Fire.wav" 
SWEP.Primary.TakeAmmo = 1
SWEP.Primary.Recoil = .5
SWEP.Primary.Spread = .24   
SWEP.Primary.Damage = 20
SWEP.Primary.ClipSize = 25
SWEP.Primary.DefaultClip = 25
SWEP.Primary.NumberofShots = 1 
SWEP.Primary.Delay = .15
SWEP.Primary.Force = 15 
SWEP.Primary.Automatic    = true
SWEP.Primary.BulletShot = true;
--------------------------------------------------------------------------------|

SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
--------------------------------------------------------------------------------|

SWEP.IronSightsPos = Vector(3.5, -3, -.1)
SWEP.IronSightsAng = Vector( 0, 0, 0 )
--------------------------------------------------------------------------------|

function SWEP:Initialize()  
self:SetWeaponHoldType( self.HoldType )
end 
--------------------------------------------------------------------------------|

function SWEP:Precache()
util.PrecacheSound("")
end
--------------------------------------------------------------------------------|

function SWEP:Think()
end
--------------------------------------------------------------------------------|

function SWEP:PrimaryAttack()
   if ( !self:CanPrimaryAttack() ) then return
    end
    local tr = self.Owner:GetEyeTrace();
   if ( self.Primary.BulletShot ) then
local bullet = {} 

bullet.Num = self.Primary.NumberofShots //The number of shots fired
bullet.Src = self.Owner:GetShootPos() //Gets where the bullet comes from
bullet.Dir = self.Owner:GetAimVector() //Gets where you're aiming
bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0)
bullet.Tracer = 1 
bullet.Force = self.Primary.Force 
bullet.Damage = self.Primary.Damage 
bullet.AmmoType = self.Primary.Ammo 
self.Owner:FireBullets( bullet );
end

local rnda = self.Primary.Recoil * -1 
local rndb = self.Primary.Recoil * math.random(-1, 1) 
self:TakePrimaryAmmo(self.Primary.TakeAmmo) 
self:ShootEffects()
self.Weapon:MuzzleFlash()
self:EmitSound(Sound(self.Primary.Sound)) 
self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) ) 
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self.Owner:SetAnimation( PLAYER_ATTACK1 );
self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
end
--------------------------------------------------------------------------------|

function SWEP:Deploy()
   self.Weapon:SendWeaponAnim(ACT_VM_DRAW);
self.Weapon:EmitSound "pay/Para Foley.wav"
timer.Simple(.2 ,function() self.Weapon:EmitSound("pay/Para Pull.wav" ) end)
   return true
end
--------------------------------------------------------------------------------|

function SWEP:Holster()
self.Weapon:EmitSound "pay/Para Foley.wav"
   return true
end
--------------------------------------------------------------------------------|

function SWEP:Reload()
self:SetNextPrimaryFire( CurTime() + 1.8)
if ( self.Weapon:GetNetworkedBool( "reloading", false ) ) then return end
if ( self.Weapon:Clip1() < self.Primary.ClipSize && self.Owner:GetAmmoCount( self.Primary.Ammo ) > 0 ) then
self.Weapon:SetNetworkedBool( "reloading", true )
self.Weapon:SetVar( "reloadtimer", CurTime() + 0.6 )
self.Weapon:SendWeaponAnim(ACT_VM_RELOAD)
end
end
--------------------------------------------------------------------------------|

local Time = CurTime()
--------------------------------------------------------------------------------|

function SWEP:Reload()
if ( self.Weapon:Ammo1() <= 0 ) then return end
if ( self.Weapon:Clip1() >= self.Primary.ClipSize ) then return end
if (CurTime() < Time + 0.5) then return end 
Time = CurTime()

timer.Simple(1.5 ,function() self.Weapon:EmitSound("pay/Para Mag In.wav" ) end)
timer.Simple(.5 ,function() self.Weapon:EmitSound("pay/Para Mag Out.wav"   ) end)
timer.Simple(2.5 ,function() self.Weapon:EmitSound("pay/Para Mag Click.wav"   ) end)

self.Owner:SetAnimation(PLAYER_RELOAD)
self.Weapon:DefaultReload(ACT_VM_RELOAD)
end 
---------------------------------------------------------------------------------
-------------------------------|
 
Доступ закрыт.
  • Вам запрещено отвечать в темах данного форума.