FlacoBey

Untitled

Jun 3rd, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. #pragma newdecls required
  5. #pragma semicolon 1
  6.  
  7. public void OnPluginStart()
  8. {
  9.     RegConsoleCmd("sm_light", iLight);
  10. }
  11.  
  12. public Action iLight(int client, int args)
  13. {
  14.     float vPos[3];
  15.     GetClientAbsOrigin(client, vPos);
  16.    
  17.     MakeLightDynamic(vPos, view_as<float>({ 0.0, 0.0, -20.0 }), 255, 150.0);
  18. }
  19.  
  20. stock int MakeLightDynamic(float vOrigin[3], float vAngles[3], int color, float brightness)
  21. {
  22.     int entity = CreateEntityByName("light_dynamic");
  23.     if( entity == -1)
  24.         return 0;
  25.  
  26.     DispatchKeyValue(entity, "_light", "0 0 0 255");
  27.     DispatchKeyValue(entity, "brightness", "1");
  28.     DispatchKeyValueFloat(entity, "spotlight_radius", 32.0);
  29.     DispatchKeyValueFloat(entity, "distance", brightness);
  30.     DispatchKeyValue(entity, "style", "0");
  31.     SetEntProp(entity, Prop_Send, "m_clrRender", color);
  32.  
  33.     DispatchSpawn(entity);
  34.     AcceptEntityInput(entity, "TurnOn");
  35.     TeleportEntity(entity, vOrigin, vAngles, NULL_VECTOR);
  36.  
  37.     return entity;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment