DrawSprite help

I’ve got an rocket entity and I want to draw a sprite when it explodes. When I trying to do something with render.DrawSprite, I get an error:


attempt to index global 'render' (a nil value)

This is my code:


function ENT:Explode()
	util.BlastDamage( self, self:GetOwner(), self:GetPos(), 200, 100 )
	local effectdata = EffectData()
	local rocketexp= "weapons/rocket/rocklx1a.wav"
	effectdata:SetStart( self:GetPos() )
	effectdata:SetOrigin( self:GetPos() )
	effectdata:SetScale( 5 )
	self:EmitSound(rocketexp)
	util.Effect("HelicopterMegaBomb", effectdata)
	self:Remove()
end

So how to draw a custom sprite instead of effect “HelicopterMegaBomb”?

You should create a particle effect ( lua/entities/effects/whatever.lua ) and create it with util.Effect.
You can’t use render library on SERVER because it is CLIENT function.

Ok, now I have a sprite as particle, is there any way to animate it and change render mode? (or I do everything wrong?)
[img_thumb]http://i.imgur.com/CwugqNA.jpg[/img_thumb]


function EFFECT:Init( data )
	
	self.Position = data:GetOrigin()
	local Pos = self.Position
	local Norm = Vector(0,0,1)
	
	Pos = Pos + Norm * 2 	
	
	local emitter = ParticleEmitter( Pos ) 	
			
		for i=1, 20 do
				
			local particle = emitter:Add( "sfx/flame1", Pos + Vector( -0, 0, 0 ) )
				
				particle:SetVelocity( Vector( 0, 0, 0 ) )		
				particle:SetDieTime( 1 ) 		
				particle:SetStartAlpha( 100 ) 	
				particle:SetStartSize( 40 ) 	
				particle:SetEndSize( 45 ) 
				particle:SetRollDelta( 0 )
				particle:SetColor( 255, 255, 255 )
				particle:VelocityDecay( false )
		end

end

You’ll have to use a special .vmt for your texture, see how default ones are done.

I know. That sprite works fine on maps with Additive render mode.

Now I almost understood how to use render.DrawSprite, but how to play sprite animation?