Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddCSLuaFile()
- SWEP.PrintName = "Unstable Rocket Launcher"
- SWEP.Author = "Mind"
- SWEP.Instructions = "Blow Up All!"
- SWEP.Spawnable = true
- SWEP.AdminOnly = false
- SWEP.Base = "weapon_base"
- SWEP.Category = "Mind's SWEPS"
- SWEP.Primary.ClipSize = 2
- SWEP.Primary.DefaultClip = 20
- SWEP.Primary.Automatic = false
- SWEP.Primary.Ammo = "RPG_Round"
- SWEP.Primary.NumShots = 1
- SWEP.Primary.TakeAmmoPerBullet = false
- SWEP.Secondary.ClipSize = -1
- SWEP.Secondary.DefaultClip = -1
- SWEP.Secondary.Automatic = false
- SWEP.Secondary.Ammo = "none"
- SWEP.Secondary.NumShots = 1
- SWEP.Secondary.TakeAmmoPerBullet = false
- SWEP.Weight = 5
- SWEP.AutoSwitchTo = true
- SWEP.AutoSwitchFrom = false
- SWEP.Slot = 3
- SWEP.SlotPos = 1
- SWEP.DrawAmmo = true
- SWEP.DrawCrosshair = true
- SWEP.ViewModel = "models/weapons/c_rpg.mdl"
- SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl"
- SWEP.UseHands = true
- SWEP.ViewModelFOV = 64
- function SWEP:Initialize()
- self:SetWeaponHoldType("rpg")
- end
- function SWEP:PrimaryAttack()
- if ( !self:CanPrimaryAttack() ) then return end
- self:TakePrimaryAmmo(1)
- timer.Create("xtremelunch", 0.12, 5, function()
- if not self.Weapon or not self.Owner then return end
- self.Weapon:SetNextPrimaryFire( CurTime() + 3 )
- self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
- self.Owner:SetAnimation(PLAYER_ATTACK1)
- self.Owner:MuzzleFlash()
- self.Owner:ViewPunch(Angle(math.Rand(-0.25, -0.15), math.Rand(-0.23, 0.23), 0.1 ))
- if ( CLIENT ) then return end
- local ent = ents.Create( "rocket_ent" )
- if ( !IsValid( ent ) ) then return end
- ent:SetPos(self.Owner:GetShootPos() + self.Owner:EyeAngles():Right() * 10 + self.Owner:GetAimVector() * xxx - self.Owner:EyeAngles():Up() * 6)
- ent:SetAngles( self.Owner:EyeAngles() )
- ent:SetModel("models/weapons/w_missile_closed.mdl")
- ent:SetPhysicsAttacker(self.Owner)
- ent:SetOwner(self.Owner)
- ent:Spawn()
- local phys = ent:GetPhysicsObject()
- if ( !IsValid( phys ) ) then ent:Remove() return end
- phys:EnableGravity(false)
- phys:ApplyForceCenter(self.Owner:GetAimVector() * 1000000000000)
- cleanup.Add( self.Owner, "props", ent )
- self:EmitSound("weapons/rpg/rocketfire1.wav")
- end)
- end
- SWEP.entr = nil
- function SWEP:SecondaryAttack()
- if not self:CanPrimaryAttack() then return end
- self:TakePrimaryAmmo(1)
- self.Weapon:SetNextSecondaryFire(CurTime() + 3)
- self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
- self.Owner:SetAnimation(PLAYER_ATTACK1)
- self.Owner:MuzzleFlash()
- self.Owner:ViewPunch(Angle(math.Rand(-0.25, -0.15), math.Rand(-0.23, 0.23), 0.1))
- // if CLIENT then return end
- self.entr = ents.Create("homingmiss_ent")
- self.entr:SetPos(self.Owner:GetShootPos() + self.Owner:EyeAngles():Right() * 10 + self.Owner:GetAimVector() * 20 - self.Owner:EyeAngles():Up() * 6)
- self.entr:SetAngles(self.Owner:EyeAngles())
- self.entr:SetModel("models/weapons/w_missile_closed.mdl")
- self.entr:SetPhysicsAttacker(self.Owner)
- self.entr:SetOwner(self.Owner)
- self.entr:Spawn()
- self.entr:SetNWBool("hui132123hui", true)
- local phys = self.entr:GetPhysicsObject()
- if not IsValid(phys) then self.entr:Remove() return end
- phys:EnableGravity(false)
- phys:ApplyForceCenter(self.Owner:GetAimVector() * 1000000000)
- cleanup.Add(self.Owner, "props", self.entr)
- self:EmitSound("weapons/rpg/rocketfire1.wav")
- end
- function SWEP:DrawHUD()
- local sosiska
- for k, v in pairs(ents.GetAll()) do
- if IsValid(v) and v:GetNWBool("hui132123hui") and v:GetNWEntity("target") then sosiska = v:GetNWEntity("target"):GetPos():ToScreen() end
- end
- if sosiska then
- surface.SetDrawColor(Color(0, 255, 10, 230))
- surface.DrawLine(sosiska.x - 8.5, sosiska.y + 8)
- surface.DrawLine(sosiska.x - 8.7, sosiska.y + 8.3)
- end
- end
- function SWEP:Reload()
- self:DefaultReload(ACT_VM_RELOAD)
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement