Files
VnUtest/garrysmod/addons/tfa_antitank/lua/weapons/weapon_sw_rpg28.lua
2026-03-31 10:27:04 +03:00

268 lines
9.2 KiB
Lua

-- БИБА СТРОЧКА 100!!!!!!!
SWEP.Gun = ("weapon_sw_rpg28") -- 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-28" -- 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/javelin_c.mdl" -- Weapon view model
SWEP.WorldModel = "models/weapons/rpg28_launcher.mdl" -- Weapon world model
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")
SWEP.Primary.RPM = 325 -- This is in Rounds Per Minute
SWEP.Primary.ClipSize = 1 -- Size of a clip
SWEP.Primary.DefaultClip = 3 -- 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.ShowViewModel = false
SWEP.ShowWorldModel = 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 = 25 -- 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
SWEP.Scoped = true
-- Enter iron sight info and bone mod info below
SWEP.IronSightsPos = Vector(-9, 1, -9)
SWEP.IronSightsAng = Vector(0, -5, 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 = -1.5,
Right = 1,
Forward = 0
},
Ang = {
Up = -1,
Right = -2,
Forward = 178
},
Scale = 1
} --Procedural world model animation, defaulted for CS:S purposes.
SWEP.ViewModelBoneMods = {
["j_gun"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(-18, -5, -8), angle = Angle(-10, 0, 3) }
}
SWEP.VElements = {
["nlaw"] = { type = "Model", model = "models/weapons/rpg28_launcher.mdl", bone = "j_gun", rel = "", pos = Vector(0, 0, 0), angle = Angle(0, 180, 0), size = Vector(0.8, 0.8, 0.8), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.WElements = {
["nlaw"] = { type = "Model", model = "models/weapons/rpg28_launcher.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(0.3, 2, 1), angle = Angle(10, 180, 180), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
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.ReticleScale = 0.7
SWEP.ScopeScale = 0.5
DEFINE_BASECLASS( SWEP.Base )
SWEP.Primary.AttacksWithNoAmmo = true
SWEP.Primary.ClipSize = -1
function SWEP:PrimaryAttack()
if not SERVER then return end
if self._NextFire and self._NextFire > CurTime() then return end
self._NextFire = CurTime() + 0.5
self:FireShot()
end
function SWEP:FireShot()
if not SERVER then return end
local ply = self:GetOwner()
if not IsValid(ply) then return end
ply:EmitSound("weapons/at4/at4_fp.wav", 100, 100, 1, CHAN_WEAPON)
local eyePos = ply:GetShootPos()
local eyeAng = ply:EyeAngles()
local safetyDist = 3 * 52.49
local tr = util.TraceLine({
start = eyePos,
endpos = eyePos + eyeAng:Forward() * safetyDist,
filter = ply
})
if tr.Hit then
ply:EmitSound("weapons/rpg/rocketclose.wav", 75, 100, 1, CHAN_ITEM)
local inert = ents.Create("prop_physics")
if IsValid(inert) then
inert:SetModel("models/weapons/fas2/world/explosives/rpg26/rocket.mdl")
inert:SetPos(eyePos + eyeAng:Forward() * 10)
inert:SetAngles(eyeAng)
inert:Spawn()
inert:Activate()
local phys = inert:GetPhysicsObject()
if IsValid(phys) then
phys:SetVelocity(eyeAng:Forward() * 300)
end
timer.Simple(10, function()
if IsValid(inert) then inert:Remove() end
end)
end
self:DropTube()
ply:StripWeapon(self:GetClass())
return
end
local spawnPos = eyePos + eyeAng:Forward() * 40
local missile = ents.Create("lvs_missile")
if not IsValid(missile) then return end
missile:SetPos(spawnPos)
missile:SetAngles(eyeAng)
missile:Spawn()
missile:Activate()
missile:SetDamage(3000)
missile:SetRadius(180)
missile:SetForce(90000)
missile:SetAttacker(ply)
missile:SetEntityFilter({ply})
missile:SetTurnSpeed(0)
missile:SetSpeed(1800)
missile.Autopilot = false
timer.Simple(0, function()
if IsValid(missile) then
local phys = missile:GetPhysicsObject()
if IsValid(phys) then
phys:SetVelocity(eyeAng:Forward() * 1800)
phys:SetAngles(eyeAng)
end
end
end)
missile:Enable()
ParticleEffect("ins_weapon_rpg_frontblast", spawnPos, eyeAng, ply)
ParticleEffect("ins_weapon_rpg_backblast", spawnPos - eyeAng:Forward()*80, eyeAng - Angle(0,180,0), ply)
local phys = ply:GetPhysicsObject()
if IsValid(phys) then
phys:ApplyForceOffset(-eyeAng:Forward() * 2000, eyePos)
end
self:DropTube()
ply:StripWeapon(self:GetClass())
end
function SWEP:DropTube()
local ply = self:GetOwner()
if not IsValid(ply) then return end
local eyePos = ply:EyePos()
local eyeAng = ply:EyeAngles()
local tube = ents.Create("prop_physics")
if not IsValid(tube) then return end
tube:SetModel(self.WorldModel)
tube:SetPos(eyePos + eyeAng:Forward() * -20)
tube:SetAngles(eyeAng)
tube:Spawn()
tube:Activate()
ply:StripWeapon(self:GetClass())
timer.Simple(3, function()
if IsValid(tube) then tube:Remove() end
end)
end
if CLIENT then
SWEP.Secondary.ScopeTable =
{
ScopeBorder = Color(0, 0, 0, 255),
ScopeMaterial = Material("models/eryx/noise"),
ScopeOverlay = Material("models/eryx/overlay"),
ScopeCrosshair = { -- can also be just a Material() value
r = 0, g = 0, b = 0, a = 255, -- color
scale = 1, -- scale or crosshair line width if no material specified
Material = Material("scope/gdcw_acogcross"), -- material, OPTIONAL!
}
}
end
SWEP.SequenceRateOverrideScaled = {
[ACT_VM_PRIMARYATTACK] = 0.85,
[ACT_VM_PRIMARYATTACK_1] = 0.85
}
SWEP.ProjectileVelocity = 7150 * 12 / 10 --Entity to shoot's velocity
SWEP.DisableChambering = true