Advertisement
FlacoBey

Untitled

Jul 5th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.41 KB | None | 0 0
  1. #pragma semicolon 1
  2. #pragma newdecls required
  3.  
  4. #include <sourcemod>
  5. #include <sdktools>
  6.  
  7. public Plugin myinfo=
  8. {
  9.     name = "WitchLight",
  10.     author = "BHaType && (Thanks dragokas for help)",
  11.     description = "Неплохое улучшения визуализации глаз вичек.",
  12.     version = "0.0.8.5",
  13.     url = "N/A"
  14. };
  15.  
  16. /*
  17.     0.0.8.4
  18.      - Added check for valid witch entity.
  19.      - Removed unused "beam_spotlight" entity creation.
  20.      - Removed model precaching. Why do I need this?
  21.      - Removed unused stock.
  22.  
  23.     0.0.8.3
  24.      - Removed ConVars, removed alpha because it is not suitable.
  25.      - Added color random by special scheme (previous version with HDRColorScale 0.6 is too bright).
  26.      - Converted to methodmaps.
  27.    
  28. */
  29.  
  30. int g_iLight[3];
  31.  
  32. public void OnMapStart()
  33. {
  34.     //if (!IsModelPrecached("models/infected/witch.mdl")) PrecacheModel("models/infected/witch.mdl");
  35.     //if (!IsModelPrecached("models/infected/witch_bride.mdl")) PrecacheModel("models/infected/witch_bride.mdl");
  36. }
  37.  
  38. public void OnPluginStart()
  39. {
  40.     HookEvent("witch_spawn", hWitchSpawned);
  41. }
  42.  
  43. public Action hWitchSpawned(Event event, const char[] name, bool dontBroadcast)
  44. {
  45.     int Witch = event.GetInt("witchid");
  46.     if (Witch && IsValidEntity(Witch)) {
  47.         //int entity = CreateEntityByName("beam_spotlight");
  48.         //if(entity != -1 && IsValidEntity(entity))
  49.         {
  50.             float flOrigin[3], flAngles[3];
  51.  
  52.             GetEntPropVector(Witch, Prop_Send, "m_vecOrigin", flOrigin);
  53.             GetEntPropVector(Witch, Prop_Send, "m_angRotation", flAngles);
  54.            
  55.             for (int iLight = 0; iLight < 2; iLight++)
  56.             {
  57.                 vLightProp(Witch, iLight, flOrigin, flAngles);
  58.             }
  59.         }
  60.     }
  61. }
  62.  
  63. static void vLightProp(int Witch, int light, float origin[3], float angles[3])
  64. {
  65.     int color[3];
  66.  
  67.     color[0] = GetRandomInt(50, 100);
  68.     color[1] = GetRandomInt(50, 100);
  69.     color[2] = GetRandomInt(50, 100);
  70.    
  71.     color[GetRandomInt(0,2)] = GetRandomInt(100, 140);
  72.     color[GetRandomInt(0,2)] = 0;
  73.    
  74.     g_iLight[light] = CreateEntityByName("beam_spotlight");
  75.     DispatchKeyValueVector(g_iLight[light], "origin", origin);
  76.     DispatchKeyValueVector(g_iLight[light], "angles", angles);
  77.     SetEntityRenderColor(g_iLight[light], color[0], color[1], color[2], 255);
  78.     DispatchKeyValue(g_iLight[light], "spotlightwidth", "10");
  79.     DispatchKeyValue(g_iLight[light], "spotlightlength", "120");
  80.     DispatchKeyValue(g_iLight[light], "spawnflags", "3");
  81.     DispatchKeyValue(g_iLight[light], "maxspeed", "100");
  82.     DispatchKeyValue(g_iLight[light], "HDRColorScale", "0.6");
  83.     DispatchKeyValue(g_iLight[light], "fadescale", "1");
  84.     DispatchKeyValue(g_iLight[light], "fademindist", "-1");
  85.    
  86.     vSetEntityParent(g_iLight[light], Witch);
  87.  
  88.     switch (light)
  89.     {
  90.         case 0:
  91.         {
  92.             SetVariantString("reye");
  93.             vSetVector(angles, 0.0, 0.0, 0.0);
  94.         }
  95.         case 1:
  96.         {
  97.             SetVariantString("leye");
  98.             vSetVector(angles, 0.0, 0.0, 0.0);
  99.         }
  100.     }
  101.  
  102.     AcceptEntityInput(g_iLight[light], "SetParentAttachment");
  103.     AcceptEntityInput(g_iLight[light], "Enable");
  104.     AcceptEntityInput(g_iLight[light], "DisableCollision");
  105.  
  106.     SetEntPropEnt(g_iLight[light], Prop_Send, "m_hOwnerEntity", Witch);
  107.     TeleportEntity(g_iLight[light], NULL_VECTOR, angles, NULL_VECTOR);
  108.     DispatchSpawn(g_iLight[light]);
  109. }
  110.  
  111. stock void vSetEntityParent(int entity, int parent)
  112. {
  113.     SetVariantString("!activator");
  114.     AcceptEntityInput(entity, "SetParent", parent);
  115. }
  116.  
  117. stock void vSetVector(float target[3], float x, float y, float z)
  118. {
  119.     target[0] = x;
  120.     target[1] = y;
  121.     target[2] = z;
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement