Raised This Month: $51 Target: $400
 12% 

[CS:GO][/ANY] Colored Flashlight


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
mastah7991
AlliedModders Donor
Join Date: Sep 2014
Location: Poland
Old 01-13-2019 , 13: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 14:15.
mastah7991 is offline
 



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 07:11.


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