Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #pragma newdecls required
- #pragma semicolon 1
- public void OnPluginStart()
- {
- RegConsoleCmd("sm_light", iLight);
- }
- public Action iLight(int client, int args)
- {
- float vPos[3];
- GetClientAbsOrigin(client, vPos);
- MakeLightDynamic(vPos, view_as<float>({ 0.0, 0.0, -20.0 }), 255, 150.0);
- }
- stock int MakeLightDynamic(float vOrigin[3], float vAngles[3], int color, float brightness)
- {
- int entity = CreateEntityByName("light_dynamic");
- if( entity == -1)
- return 0;
- DispatchKeyValue(entity, "_light", "0 0 0 255");
- DispatchKeyValue(entity, "brightness", "1");
- DispatchKeyValueFloat(entity, "spotlight_radius", 32.0);
- DispatchKeyValueFloat(entity, "distance", brightness);
- DispatchKeyValue(entity, "style", "0");
- SetEntProp(entity, Prop_Send, "m_clrRender", color);
- DispatchSpawn(entity);
- AcceptEntityInput(entity, "TurnOn");
- TeleportEntity(entity, vOrigin, vAngles, NULL_VECTOR);
- return entity;
- }
Advertisement
Add Comment
Please, Sign In to add comment