Global/DynamicLight

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=DynamicLight
+
|Description=Creates or replaces a dynamic light with the given id. 32 lights can be active at once.
|Parent=Global
+
|Description=Creates or replaces a dynamic light with the given id.
+
 
|Realm=Client
 
|Realm=Client
 
|IsClass=No
 
|IsClass=No
Line 9: Line 7:
 
|type=number
 
|type=number
 
|name=index
 
|name=index
|desc=An unsigned Integer. Usually an entity index is used here. 32 lights can be active at once.
+
|desc=An unsigned Integer. Usually an entity index is used here.
 
}}
 
}}
 
{{Ret
 
{{Ret

Revision as of 02:37, 8 September 2018

 DynamicLight( )

Contents

Description

Creates or replaces a dynamic light with the given id. 32 lights can be active at once.

Arguments

number index

An unsigned Integer. Usually an entity index is used here.

Returns

table

A DynamicLight structured table. See DynamicLight structure

Examples

Example

Emits a bright white light from local players eyes.

hook.Add( "Think", "Think_Lights!", function()
	local dlight = DynamicLight( LocalPlayer():EntIndex() )
	if ( dlight ) then
		dlight.pos = LocalPlayer():GetShootPos()
		dlight.r = 255
		dlight.g = 255
		dlight.b = 255
		dlight.brightness = 2
		dlight.Decay = 1000
		dlight.Size = 256
		dlight.DieTime = CurTime() + 1
	end
end )


Personal tools
Navigation