Raised This Month: $37 Target: $400
 9% 

[CS:GO][/ANY] Colored Flashlight


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mastah7991
AlliedModders Donor
Join Date: Sep 2014
Location: Poland
Old 01-13-2019 , 14:18   [CS:GO][/ANY] Colored Flashlight
Reply With Quote #1

Hi
i want show you simple code to create a flashlight

Code:
float playerPos[3];
	float playerAng[3];
	GetEntPropVector(client, Prop_Send, "m_vecOrigin", playerPos);
	GetEntPropVector(client, Prop_Send, "m_angRotation", playerAng);
	
 	int entlight =  CreateEntityByName("light_dynamic");  

	if (entlight != -1)    
    {     
		DispatchKeyValue(entlight, "_light", "0 132 255");  
        DispatchKeyValue(entlight, "brightness", "5");  
 
        DispatchKeyValueFloat(entlight, "distance", 2400.0);  
		DispatchKeyValueFloat(entlight, "spotlight_radius", 200.0);  

		DispatchKeyValueFloat(entlight, "_inner_cone", 0.0);  
		DispatchKeyValueFloat(entlight, "_cone", 360.0);  
 
        DispatchSpawn(entlight);
		TeleportEntity(entlight , playerPos, playerAng,NULL_VECTOR);
	
		SetVariantString("!activator");
		AcceptEntityInput(entlight, "SetParent", GetEntPropEnt(client,Prop_Send,"m_hViewModel"), entlight, 0);
	}
INPUTS:
https://developer.valvesoftware.com/wiki/Light_dynamic

Toggle the light on/off:
Code:
	AcceptEntityInput(entlight, "Toggle");
Limit:
"For the 2013 SDK this is limited to 17 lights on at any one time so use wisely."

Thanks Bacardi

__________________
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.”
― Rick Cook, The Wizardry Compiled

Last edited by mastah7991; 01-13-2019 at 15:15.
mastah7991 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-13-2019 , 14:40   Re: [CS:GO][/ANY] Colored Flashlight
Reply With Quote #2

Nice.
But is this true ?
Quote:
Note:For the 2013 SDK this is limited to 17 lights on at any one time so use wisely.
Bacardi is offline
mastah7991
AlliedModders Donor
Join Date: Sep 2014
Location: Poland
Old 01-13-2019 , 15:03   Re: [CS:GO][/ANY] Colored Flashlight
Reply With Quote #3

it's true :/
__________________
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.”
― Rick Cook, The Wizardry Compiled
mastah7991 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:36.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode