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