Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --If you'd like all the files they are available to download: https://mega.nz/#!h9BygCqB!L40NIkKQ1Qg5EOZykaeu3OLJmRWnX6iy20A29-1PBss
- AddCSLuaFile()
- AddCSLuaFile("effects/pewtrace.lua")
- AddCSLuaFile("effects/pewbounce.lua")
- SWEP.HoldType = "pistol"
- SWEP.PrintName = "Pew Gun"
- SWEP.Slot = 2
- SWEP.SlotPos = 2
- SWEP.ViewModelFlip = false
- SWEP.ViewModelFOV = 45
- SWEP.Category = "BrandoSweps"
- SWEP.Base = "weapon_base"
- SWEP.Primary.Recoil = 0.3
- SWEP.Primary.Damage = 15
- SWEP.Primary.Delay = 0.25
- SWEP.Primary.Cone = 0
- SWEP.Primary.ClipSize = 180
- SWEP.Primary.Automatic = true
- SWEP.Primary.DefaultClip = 180
- SWEP.Primary.ClipMax = 100
- SWEP.Primary.Ammo = "Pistol"
- SWEP.Primary.Sound = Sound( "entities/weapons/pew/pew.wav" )
- SWEP.Spawnable = true
- SWEP.AutoSpawnable = false
- SWEP.AmmoEnt = "item_ammo_pistol_ttt"
- SWEP.Kind = WEAPON_PISTOL
- --SWEP.Tracer = "AirboatGunHeavyTracer"
- SWEP.UseHands = true
- SWEP.ViewModel = "models/weapons/c_pistol.mdl"
- SWEP.WorldModel = "models/weapons/w_pistol.mdl"
- ----TTT----
- SWEP.EquipMenuData = {
- type = "item_weapon",
- desc = [[The PEW GUN
- Shoots Lasers
- Makes a cool PEW sound
- Has a 1 in 5 chance to set traitors on fire
- ]]
- }
- SWEP.Icon = "pew/ttt_icon.png"
- SWEP.Kind = WEAPON_EQUIP2
- SWEP.CanBuy = { ROLE_DETECTIVE }
- SWEP.LimitedStock = false
- if ( GAMEMODE.Name == "Trouble in Terrorist Town" ) then
- SWEP.Base = "weapon_tttbase"
- SWEP.Primary.Damage = 14
- SWEP.Primary.ClipSize = 60
- SWEP.Primary.DefaultClip = 60
- SWEP.Primary.ClipMax = 100
- SWEP.Primary.Delay = 0.3
- SWEP.Slot = 1
- end
- ----TTT----
- function SWEP:DoImpactEffect(trace, dmgType)
- local effectdata = EffectData()
- effectdata:SetStart( trace.HitPos )
- --effectdata:SetOrigin( trace.HitNormal + Vector( math.Rand( -0.5, 1 ), math.Rand( -0.3, 1 ), math.Rand( 0, 0 ) ) )
- effectdata:SetOrigin( trace.HitNormal + Vector(0, 0, 0.01))
- util.Effect( "pewbounce", effectdata )
- if trace.HitWorld then
- if SERVER or (CLIENT and IsFirstTimePredicted()) then
- local imp = EffectData()
- imp:SetOrigin(trace.HitPos + trace.HitNormal)
- imp:SetNormal(trace.HitNormal)
- imp:SetMagnitude(1)
- imp:SetScale(1)
- imp:SetRadius(2)
- util.Effect("Sparks", imp)
- end
- else return end
- end
- function SWEP:PrimaryAttack()
- self:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
- cone = self.Primary.Cone
- pew = {}
- pew.Num = 1
- pew.Src = self:GetOwner():GetShootPos()
- pew.Dir = self:GetOwner():GetAimVector()
- pew.Spread = Vector( cone, cone, 0 )
- pew.Delay = self.Primary.Delay
- pew.Tracer = 1
- pew.Force = 2
- pew.Damage = self.Primary.Damage
- pew.TracerName = self.Tracer
- pew.AmmoType = self.Primary.Ammo
- pew.TracerName = "pewtrace"
- pew.Callback = function(attacker, trace, dmginfo)
- dmginfo:SetDamageType(DMG_DISSOLVE)
- if ( GAMEMODE.Name == "Trouble in Terrorist Town" ) then
- dmginfo:SetDamageType(DMG_BULLET)
- end
- if SERVER or (CLIENT and IsFirstTimePredicted()) then
- local ent = trace.Entity
- if (not trace.HitWorld) and IsValid(ent) then
- local edata = EffectData()
- ent:EmitSound("weapons/stunstick/stunstick_fleshhit".. math.random(1,2) .. ".wav", 60, 130)
- edata:SetEntity(ent)
- edata:SetMagnitude(1)
- edata:SetScale(5)
- util.Effect("TeslaHitboxes", edata)
- end
- if SERVER then
- if (not trace.HitWorld) and ent:IsPlayer() and ent:IsValid() and not ent:IsRagdoll() then
- local rndm = math.random(1, 5)
- if self:GetOwner():GetRole() == ROLE_JESTER then return end
- if ent:GetRole() == ROLE_TRAITOR and rndm == 2 then ent:Ignite(5, 5) end
- if ent:GetRole() == ROLE_INFECTED then ent:Ignite(5, 2) end
- end
- end
- end
- end
- self:TakePrimaryAmmo(1)
- if not self:CanPrimaryAttack() then return end
- self:EmitSound(self.Primary.Sound, 75, math.random(90, 100))
- self:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
- if IsValid(self:GetOwner()) then
- self:GetOwner():SetAnimation( PLAYER_ATTACK1 )
- end
- self:GetOwner():FireBullets( pew )
- end
- function SWEP:SecondaryAttack()
- return false
- end
- function SWEP:GetHeadshotMultiplier()
- return 1.5
- end
- function SWEP:Initialize()
- self:SetHoldType("pistol")
- end
- if SERVER then return end
- SWEP.WepSelectIcon = Material( "entities/ttt_icon.png" )
- function SWEP:DrawWeaponSelection( x, y, w, h, a )
- surface.SetDrawColor( 255, 255, 255, a )
- surface.SetMaterial( self.WepSelectIcon )
- local size = math.min( w, h )
- surface.DrawTexturedRect( x + w / 2 - size / 2, y, size, size )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement