-- Variables that are used on both client and server SWEP.Gun = ("weapon_sw_rpg26") -- must be the name of your swep but NO CAPITALS! SWEP.Category = "FT | Antitank" --Category where you will find your weapons SWEP.MuzzleAttachment = "1" -- Should be "1" for CSS models or "muzzle" for hl2 models SWEP.ShellEjectAttachment = "1" -- Should be "2" for CSS models or "1" for hl2 models SWEP.Author = "Shtormer, Scripty" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Manufacturer = "FT_Scripty" SWEP.Instructions = "" SWEP.PrintName = "RPG-26" -- Weapon name (Shown on HUD) SWEP.Slot = 4 -- Slot in the weapon selection menu SWEP.SlotPos = 4 -- Position in the slot SWEP.DrawAmmo = true -- Should draw the default HL2 ammo counter SWEP.DrawWeaponInfoBox = false -- Should draw the weapon info box SWEP.BounceWeaponIcon = false -- Should the weapon icon bounce? SWEP.DrawCrosshair = true -- set false if you want no crosshair SWEP.Weight = 89 -- rank relative ot other weapons. bigger is better SWEP.AutoSwitchTo = true -- Auto switch to if we pick it up SWEP.AutoSwitchFrom = true -- Auto switch from if you pick up a better weapon SWEP.HoldType = "rpg" -- how others view you carrying the weapon -- normal melee melee2 fist knife smg ar2 pistol rpg physgun grenade shotgun crossbow slam passive -- you're mostly going to use ar2, smg, shotgun or pistol. rpg makes for good sniper rifles SWEP.ViewModelFOV = 70 SWEP.ViewModelFlip = false SWEP.ViewModel = "models/weapons/fas2/view/explosives/rpg26.mdl" SWEP.WorldModel = "models/weapons/fas2/world/explosives/rpg26.mdl" SWEP.ShowWorldModel = true SWEP.Base = "tfa_bash_base" --the Base this weapon will work on. PLEASE RENAME THE BASE! SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.FiresUnderwater = false SWEP.UseHands = true SWEP.Type = "Man-Portable Anti-Tank Weapon" SWEP.IronSightTime = 0.5 SWEP.Primary.Sound = Sound("weapons/at4/at4_fp.wav") -- This is the sound of the weapon, when you shoot. SWEP.Primary.RPM = 325 -- This is in Rounds Per Minute SWEP.Primary.ClipSize = 1 -- Size of a clip SWEP.Primary.DefaultClip = 1 -- Bullets you start with SWEP.Primary.KickUp = 2.25 -- Maximum up recoil (rise) SWEP.Primary.KickDown = 1.75 -- Maximum down recoil (skeet) SWEP.Primary.KickHorizontal = 1.45 -- Maximum up recoil (stock) SWEP.Primary.Automatic = false -- Automatic = true; Semi Auto = false SWEP.Primary.Ammo = "rpg_round" -- pistol, 357, smg1, ar2, buckshot, slam, SniperPenetratedRound, AirboatGun SWEP.Primary.StaticRecoilFactor = 1.3 SWEP.SelectiveFire = false SWEP.Secondary.BashInterrupt = false -- Do you need to be in a "ready" status to bash? SWEP.Secondary.BashDelay = 0.1 SWEP.Secondary.BashLength = 52 SWEP.Secondary.BashEnd = 2.25 -- Override bash sequence length easier SWEP.Secondary.BashDamage = 56 SWEP.Secondary.IronFOV = 50 -- How much you 'zoom' in. Less is more! SWEP.data = {} --The starting firemode SWEP.Primary.Damage = 225 -- Base damage per bullet SWEP.Primary.Spread = .021 -- Define from-the-hip accuracy 1 is terrible, .0001 is exact) SWEP.Primary.IronAccuracy = .008 -- Ironsight accuracy, should be the same for shotguns -- Enter iron sight info and bone mod info below SWEP.IronSightsPos = Vector(-2, -1, -1) SWEP.IronSightsAng = Vector(0.65, -0.02, 0) SWEP.IronSightsPos_Pgo7 = Vector(-2.5, -1, 0.6) SWEP.IronSightsAng_Pgo7 = Vector(0, 0, 0) SWEP.RunSightsPos = Vector(4.762, -4.238, -0.717) SWEP.RunSightsAng = Vector(-6.743, 46.284, 0) SWEP.InspectPos = Vector(7.76, -2, 0.016) SWEP.InspectAng = Vector(1, 37.277, 3.2) SWEP.Offset = { Pos = { Up = -2.5, Right = 1.1, Forward = 8.295 }, Ang = { Up = -1.043, Right = 0, Forward = 180, }, Scale = 1.0 } --Procedural world model animation, defaulted for CS:S purposes. SWEP.VElements = { } SWEP.Attachments = { } SWEP.WElements = { } SWEP.Sights_Mode = TFA.Enum.LOCOMOTION_HYBRID -- ANI = mdl, HYBRID = lua but continue idle, Lua = stop mdl animation SWEP.Idle_Mode = TFA.Enum.IDLE_BOTH --TFA.Enum.IDLE_DISABLED = no idle, TFA.Enum.IDLE_LUA = lua idle, TFA.Enum.IDLE_ANI = mdl idle, TFA.Enum.IDLE_BOTH = TFA.Enum.IDLE_ANI + TFA.Enum.IDLE_LUA SWEP.Sprint_Mode = TFA.Enum.LOCOMOTION_LUA -- ANI = mdl, HYBRID = ani + lua, Lua = lua only SWEP.RunSightsPos = Vector(0, -5, 0) --Change this, using SWEP Creation Kit preferably SWEP.RunSightsAng = Vector(20, 0, 0) --Change this, using SWEP Creation Kit preferably SWEP.SprintBobMult = 1.3 SWEP.SprintAnimation = { ["loop"] = { ["type"] = TFA.Enum.ANIMATION_SEQ, --Sequence or act ["value"] = "base_sprint", --Number for act, String/Number for sequence ["is_idle"] = true } } SWEP.Entities = {} function SWEP:PrimaryAttack() if not SERVER then return end if self._NextFire and self._NextFire > CurTime() then return end if self:Clip1() <= 0 then self:Reload() return end self._NextFire = CurTime() + 5.5 -- Запрет на стрельбу во время перезарядки self:FireShot() self:TakePrimaryAmmo(1) local ply = self:GetOwner() if not IsValid(ply) then return end local shootPos = ply:GetShootPos() local shootAng = ply:EyeAngles() -- Эффект вылета тубуса (через 0.2с после выстрела) timer.Simple(0.2, function() if not IsValid(ply) then return end local ent = ents.Create("prop_physics") if not IsValid(ent) then return end ent:SetModel("models/weapons/fas2/world/explosives/rpg26.mdl") ent:SetPos(shootPos + shootAng:Forward() * -20) ent:SetAngles(shootAng) ent:Spawn() ent:Activate() timer.Simple(3, function() if IsValid(ent) then ent:Remove() end end) end) end function SWEP:FireShot() if SERVER then local ply = self:GetOwner() if not IsValid(ply) then return end local safetyDist = 3 local tr = util.TraceLine({ start = ply:EyePos(), endpos = ply:EyePos() + ply:EyeAngles():Forward() * (safetyDist * 52.49), filter = ply }) if tr.Hit then ply:EmitSound("weapons/rpg/rocketclose.wav") local inert = ents.Create("prop_physics") if IsValid(inert) then inert:SetModel("models/weapons/fas2/world/explosives/rpg26/rocket.mdl") inert:SetPos(ply:EyePos() + ply:EyeAngles():Forward() * 10) inert:SetAngles(ply:EyeAngles()) inert:Spawn() inert:Activate() local phys = inert:GetPhysicsObject() if IsValid(phys) then phys:SetVelocity(ply:EyeAngles():Forward() * 300) end timer.Simple(10, function() if IsValid(inert) then inert:Remove() end end) end return end local pos = ply:EyePos() local ang = ply:EyeAngles() local missile = ents.Create("lvs_missile") if not IsValid(missile) then return end missile:SetPos(pos) missile:SetAngles(ang) missile:Spawn() missile:Activate() missile:SetDamage(1000) -- урон missile:SetRadius(120) -- радиус поражения missile:SetForce(60000) -- сила взрыва missile:SetAttacker(ply) missile:SetEntityFilter({ply}) missile:SetTurnSpeed(0) missile:SetSpeed(1500) -- скорость полёта missile:Enable() ParticleEffect("ins_weapon_rpg_frontblast", pos, ang, ply) ParticleEffect("ins_weapon_rpg_backblast", pos - ang:Forward()*80, ang - Angle(0,180,0), ply) local phys = ply:GetPhysicsObject() if IsValid(phys) then phys:ApplyForceOffset(-ang:Forward() * 2000, pos) end end end SWEP.SequenceRateOverrideScaled = { [ACT_VM_PRIMARYATTACK] = 0.85, [ACT_VM_PRIMARYATTACK_1] = 0.85 } SWEP.ProjectileVelocity = 7150 * 12 / 10 SWEP.DisableChambering = true