Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddCSLuaFile()
- SWEP.PrintName = "Thundergun"
- SWEP.Author = "Raven"
- SWEP.Purpose = ""
- SWEP.Slot = 3
- SWEP.SlotPos = 2
- SWEP.Spawnable = true
- SWEP.Category = "CoD Zombies"
- SWEP.ViewModelFOV = 55
- SWEP.ViewModel = "models/weapons/thundergun/v_thundergun.mdl"
- SWEP.WorldModel = "models/weapons/thundergun/w_thundergun.mdl"
- SWEP.UseHands = true
- SWEP.NZWonderWeapon = true
- SWEP.NZPaPName = "Zeus Cannon"
- SWEP.DrawAmmo = true
- SWEP.Primary.ClipSize = 2
- SWEP.Primary.DefaultClip = 14
- SWEP.Primary.Automatic = false
- SWEP.Primary.Ammo = "Wind Reels"
- SWEP.Secondary.Ammo = "none"
- local FireSND = "staff/air/shoot.mp3"
- game.AddAmmoType({
- name = "Wind Reels",
- dmgtype = DMG_CRUSH,
- tracer = TRACER_NONE,
- plydmg = 100,
- npcdmg = 500,
- force = 20000,
- minsplash = 100,
- maxsplash = 150
- })
- function SWEP:Initialize()
- self.Weapon:SetHoldType("crossbow")
- end
- function SWEP:Reload()
- if self:Ammo1() <= 0 or self:Clip1()>0 then
- return
- end
- self:DefaultReload(ACT_VM_RELOAD)
- end
- function SWEP:PrimaryAttack()
- if !self:CanPrimaryAttack() then
- self:Reload()
- return
- end
- local o = self.Owner
- if !IsValid(o) then
- return
- end
- self:SetNextPrimaryFire(CurTime() + 1)
- local clip = self:Clip1()
- if clip == 2 then
- self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
- self.Weapon:EmitSound("thundergun/shoot.mp3")
- elseif clip == 1 then
- self:SendWeaponAnim(ACT_VM_SECONDARYATTACK)
- self.Weapon:EmitSound("thundergun/shoot_last_bullet.mp3")
- end
- local ed,obj,start,up = EffectData(),o:LookupAttachment("anim_attachment_RH"),nil,o:GetUp()
- if obj ~= 0 then
- local pos = o:GetAttachment(obj)
- start = pos.Pos
- ed:SetEntity(o)
- ed:SetAttachment(obj)
- ed:SetAngles(pos.Ang)
- else
- start = o:GetShootPos()
- self:SendWeaponAnim(ACT_VM_IDLE)
- ed:SetEntity(self)
- ed:SetAttachment(1)
- ed:SetAngles(self:GetAimVector())
- end
- start = start + o:GetForward()*30
- ed:SetStart(start)
- util.Effect( "effect_smokering", ed )
- self:DoShot(o,start,up)
- timer.Simple(0.2,function()if IsValid(self) then self:DoShot(o,start,up)end end)
- --debugoverlay.Sphere( start, 5, 1, Color(255,255,255) )
- o:SetAnimation( PLAYER_ATTACK1 )
- self:TakePrimaryAmmo(1)
- end
- function SWEP:DoShot(o,start,up)
- if CLIENT then return end
- local ConeEnts = ents.FindInCone(self:GetOwner():GetShootPos(),
- self:GetOwner():GetAimVector(),
- 65535,90)
- for k,v in pairs(ents.FindInCone( o:LocalToWorld(o:OBBCenter()) + (o:GetForward() * -25), o:GetAngles():Forward(), 500, 0 ), o:GetAimVector() 10,)) dofor i, pEnt in ipairs(ConeEnts) do
- if pEnt:IsNPC() then
- if v == o or !IsValid(v) then continue end
- local tr = util.TraceLine({start=start,endpos=v:GetPos(),mask=MASK_SHOT_HULL})
- local p = v:IsPlayer()
- if v:IsNPC() or p then
- if p and !hook.Run("PlayerShouldTakeDamage",v,o) then
- continue
- end
- local class = v:GetClass()
- if class == "npc_helicopter" or class == "npc_combinegunship" then
- v:SetVelocity((v:GetPos()-start):GetNormal()*2500)
- timer.Simple(0.5,function()if IsValid(v) then v:Fire("selfdestruct")end end)
- elseif class == "npc_strider" then
- v:SetVelocity((v:GetPos()-start):GetNormal()*1000)
- timer.Simple(0.1,function()if IsValid(v) then v:Fire("break")end end)
- else
- if v:IsOnGround() then
- local ppos = v:GetPos()
- v:SetVelocity((ppos-start):GetNormal()*25000000/start:Distance(ppos)+up*1000)
- else
- v:SetVelocity((v:GetPos()-start):GetNormal()*1000)
- end
- timer.Simple(0.2,function()if IsValid(v) then v:TakeDamage(v:Health(),o,self.Weapon)end end)
- end
- elseif v.Type == "nextbot" then
- v.loco:SetVelocity((v:GetPos()-start):GetNormal()*5000+up*1000)
- timer.Simple(0.2,function()if IsValid(v) then v:TakeDamage(v:Health(),o,self.Weapon)end end)
- end
- end
- end
- function SWEP:SecondaryAttack()
- end
- function SWEP:Deploy()
- NextReload = CurTime() + 1
- self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
- end
- function SWEP:Holster()
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement