Garry's Mod Wiki

CreateParticleSystem

  CNewParticleEffect CreateParticleSystem( Entity ent, string effect, number partAttachment, number entAttachment = 0, Vector offset = Vector( 0, 0, 0 ) )

Description

Creates a new particle system. See also Entity:CreateParticleEffect, ParticleEffectAttach and CreateParticleSystemNoEntity.

The particle effect must be precached with PrecacheParticleSystem and the file its from must be added via game.AddParticles before it can be used!

Arguments

1 Entity ent
The entity to attach the control point to.
2 string effect
The name of the effect to create. It must be precached.
3 number partAttachment
4 number entAttachment = 0
The attachment ID on the entity to attach the particle system to
5 Vector offset = Vector( 0, 0, 0 )
The offset from the Entity:GetPos of the entity we are attaching this CP to.

Returns

1 CNewParticleEffect
The created particle system.

Example

Creates a big explosion effect at the player's feet, and deletes it 0.1 seconds after starting.

PrecacheParticleSystem( "explosion_huge_g" ) concommand.Add( "test_particle", function( ply, cmd, arg ) local part = CreateParticleSystem( ply, "explosion_huge_g", PATTACH_POINT_FOLLOW ) timer.Simple( 0.1, function() part:StopEmission( false, true, false ) end ) end )