SWEP.ShootBullet

From GMod Wiki

Revision as of 13:18, 26 January 2010 by Joerdgs (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NameShootBullet
SyntaxSWEP:ShootBullet( Integer Damage, Integer Number of Shots, Float Aim Cone )
DescriptionFires a bullet
ReturnsNil
Lua StateNewerShared.png
BBCode[b][url=wiki.garrysmod.com/?title=SWEP.ShootBullet]SWEP.ShootBullet [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]

Examples

DescriptionBecause it is a convenience function, it is defined by the game.(Source Code)
Used onNewerShared.png
Code
function SWEP:ShootBullet( damage, num_bullets, aimcone )
 
	local bullet = {}
	bullet.Num 		= num_bullets
	bullet.Src 		= self.Owner:GetShootPos()	// Source
	bullet.Dir 		= self.Owner:GetAimVector()	// Dir of bullet
	bullet.Spread 	= Vector( aimcone, aimcone, 0 )		// Aim Cone
	bullet.Tracer	= 5	// Show a tracer on every x bullets 
        bullet.TracerName = "Tracer" // what Tracer Effect should be used
	bullet.Force	= 1	// Amount of force to give to phys objects
	bullet.Damage	= damage
	bullet.AmmoType = "Pistol"
 
	self.Owner:FireBullets( bullet )
 
	self:ShootEffects()
 
end
OutputN/A


Additional Notes

AR2Tracer - Self-descripting. Visible from all directions except under it
AirboatGunHeavyTracer - Makes a bigger version of the Pulse-rifle Tracer.
AirboatGunTracer - Similar to the Pulse-rifle Tracer, only visible from above. 
Tracer - 9mm pistol tracer
StriderTracer - Similar to AR2 tracer
HelicopterTracer - Similar to GunshipTracer effect
GunshipTracer - 2x the size of the pulse-rifle tracer
LaserTracer - The tool tracer effect from the Tool Gun
 

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox