FlacoBey

Untitled

Jan 10th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.07 KB | None | 0 0
  1. #include sdktools
  2. #include sdkhooks
  3.  
  4. public OnPluginStart()
  5. {
  6.     HookEvent("witch_spawn", WitchSpawn)
  7. }
  8.  
  9. public Action WitchSpawn(Event event, const char[] name, bool dontBroadcast)
  10. {
  11.     int witchid = GetClientOfUserId(event.GetInt("witchid"));
  12.     for (int iLight = 0; iLight < 2; iLight++)
  13.     {
  14.         float eyes[3], ang[3];
  15.         GetEntPropVector(witchid, Prop_Send, "m_vecOrigin", eyes);
  16.         GetEntPropVector(witchid, Prop_Send, "m_angRotation", ang);
  17.         eyes[2] += 120.0
  18.         vLightProp(witchid, iLight, eyes, ang);
  19.     }
  20. }
  21.  
  22. static vLightProp(int tank, int light, float origin[3], float angles[3])
  23. {
  24.     decl String:s_TargetName[32];
  25.    
  26.     new g_iLight = CreateEntityByName("beam_spotlight");
  27.     if (IsValidEntity(g_iLight))
  28.     {
  29.         FormatEx(s_TargetName, sizeof(s_TargetName), "witch%d", tank);
  30.         DispatchKeyValue(tank, "targetname", s_TargetName)
  31.         DispatchKeyValue(g_iLight, "parentname", s_TargetName)
  32.         DispatchKeyValueVector(g_iLight, "origin", origin);
  33.         DispatchKeyValueVector(g_iLight, "angles", angles);
  34.        
  35.         DispatchKeyValue(g_iLight, "spotlightwidth", "10");
  36.         DispatchKeyValue(g_iLight, "spotlightlength", "60");
  37.         DispatchKeyValue(g_iLight, "spawnflags", "3");
  38.         DispatchKeyValue(g_iLight, "maxspeed", "100");
  39.         DispatchKeyValue(g_iLight, "HDRColorScale", "0.7");
  40.         DispatchKeyValue(g_iLight, "fadescale", "1");
  41.         DispatchKeyValue(g_iLight, "fademindist", "-1");
  42.         SetVariantString(s_TargetName);
  43.         AcceptEntityInput(tank, "SetParent", g_iLight);
  44.         AcceptEntityInput(g_iLight, "DisableShadow")
  45.         AcceptEntityInput(g_iLight, "Enable");
  46.         AcceptEntityInput(g_iLight, "DisableCollision");
  47.         switch (light)
  48.         {
  49.             case 0:
  50.             {
  51.                 SetVariantString("reye");
  52.             }
  53.             case 1:
  54.             {
  55.                 SetVariantString("leye");
  56.             }
  57.         }
  58.         TeleportEntity(g_iLight, NULL_VECTOR, angles, NULL_VECTOR);
  59.         DispatchSpawn(g_iLight);
  60.     }
  61. }
  62.  
  63. stock void vSetVector(float target[3], float x, float y, float z)
  64. {
  65.     target[0] = x;
  66.     target[1] = y;
  67.     target[2] = z;
  68. }
  69.  
  70.  
  71. stock void vSetEntityParent(int entity, int parent)
  72. {
  73.     SetVariantString("!activator");
  74.     AcceptEntityInput(entity, "SetParent", parent);
  75. }
Advertisement
Add Comment
Please, Sign In to add comment