All pastes #587863 Raw Edit

Anonymous

public text v1 · immutable
#587863 ·published 2007-06-25 04:25 UTC
rendered paste body
if ( SERVER ) then

	AddCSLuaFile( "shared.lua" )
	
	SWEP.HoldType			= "pistol"
	
end

if ( CLIENT ) then

	SWEP.PrintName			= "BeamSMG"			
	SWEP.Author				= "Narc0tiX.and.B4nny"
	SWEP.Contact			= ""
	SWEP.Purpose			= "Fires a high velocity projectile with deadly accuracy. Unlimited shots, powered by electricity!"
	SWEP.Instructions		= "Point at target, pull trigger, repeat until sexually satisfied."
	SWEP.Slot				= 1
	SWEP.SlotPos			= 5
	SWEP.IconLetter			= "u"
	
	killicon.AddFont( "weapon_fiveseven", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )
	
end

--Use the default CS weapon base
SWEP.Base				= "weapon_cs_base"

--Make it not spawnable by normal users, but spawnable by admin
SWEP.Spawnable			= true
SWEP.AdminSpawnable		= true

--Set the view model of the fiveseven (what you see)
SWEP.ViewModel			= "models/weapons/v_smg_p90.mdl"
--Set the world model of the fiveseven (what everyone else sees)
SWEP.WorldModel			= "models/weapons/w_smg_p90.mdl"
--Set the weight of the weapon
SWEP.Weight				= 5

--Tell it whether or not it should automatically switch to/from this weapon
SWEP.AutoSwitchTo		= false
SWEP.AutoSwitchFrom		= false
--The sound this gun makes when it is fired
SWEP.Primary.Sound			= Sound( "Weapon_UMP45.Single" )
--The recoil of the gun when fired (we want it to be zero for a good admin gun)
SWEP.Primary.Recoil			= 0
--The damage this gun will deal out per shot! (we want it exceptionally high)
SWEP.Primary.Damage			= 5000000
--How many shots?
SWEP.Primary.NumShots		= 25
--The cone of this weapon (accuracy)
SWEP.Primary.Cone			= 0.1
--How many bullets does this clip hold? (We'll make it one, becuase the clip will be endless)
SWEP.Primary.ClipSize		= 1
--Delay between shots
SWEP.Primary.Delay			= 0.1
--How big should the default clip be
SWEP.Primary.DefaultClip	= 1
--Is the weapon fully automatic?
SWEP.Primary.Automatic		= true
--What ammo does it take
SWEP.Primary.Ammo			= "smg"

--No secondary fire, so just let it be -1, and none for ammo type.
SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic	= false
SWEP.Secondary.Ammo			= "none"

--Set the iron sights so that they CORRECTLY line up with the bullet trajectory.
SWEP.IronSightsPos = Vector(4.55,-9.5,2.04)
SWEP.IronSightsAng = Vector(-.3,-.075,0)

--Fire the weapon!
function SWEP:PrimaryAttack()
--If the weapon can attack...
	if ( !self:CanPrimaryAttack() ) then return end
--Fire bullet downrange at target

	local bullet = { }
	 	bullet.Num 			= 1
	 	bullet.Src 			= self.Owner:GetShootPos()	-- Source 
	 	bullet.Dir 			= self.Owner:GetAimVector()	-- Direction of bullet 
	 	bullet.Spread 		= Vector( 0.02, 0.02, 0 )	-- Aim Cone 
	 	bullet.Tracer		= 1							-- Show a tracer on every x bullets  
	 	bullet.Force		= 5000000		-- Amount of force to give to phys objects 
	 	bullet.Damage		= 5000000 
	 	bullet.AmmoType 	= "Pistol" 
	 	bullet.TracerName 	= "ToolTracer" 

	self.Owner:FireBullets( bullet )
--BOOM! Emit the weapon sound for this weapon
	self.Weapon:EmitSound(self.Primary.Sound)
-- This doesn't trace the bullet, just where the player is looking ;)
	--local trace = self.Owner:GetEyeTrace()
--do the effects
	self:ShootEffects()
--Set a delay between shots of 0.08 seconds.
	self.Weapon:SetNextPrimaryFire( CurTime() + 0.1 )
--The admin gun has unlimited ammo so don't take a bullet away!
	self:TakePrimaryAmmo( 0 )

--[[ Old Gun Effects
--Effect data for the toolgun effect
local effectdata = EffectData()
--Start the beam from the hit position of the bullet
	effectdata:SetOrigin( trace.HitPos )
--Trace the beam all the way back to the shoot position
	effectdata:SetStart( self.Owner:GetShootPos() )
--Attach the beam
	effectdata:SetAttachment( 1 )
--Set the entity for the beam
	effectdata:SetEntity( self.Weapon )
--Do the effect
	util.Effect( "ToolTracer", effectdata )
]]--
end

--Gun Effects
function SWEP:ShootEffects()
--Muzzleflash
	self.Owner:MuzzleFlash()
--Attack animation
	self.Owner:SetAnimation( PLAYER_ATTACK1 )
--Weapon slide animation
	self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
end

--Is the clip full (unnecessary, because clip is always full.)
function SWEP:CanPrimaryAttack()
	return true
end