Advertisement
FlacoBey

Untitled

Feb 7th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.93 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <sdkhooks>
  4.  
  5. new g_iLight[3];
  6.  
  7. ConVar R,G,B,A;
  8.  
  9. public OnMapStart()
  10. {
  11.     if (!IsModelPrecached("models/infected/witch.mdl")) PrecacheModel("models/infected/witch.mdl");
  12.     if (!IsModelPrecached("models/infected/witch_bride.mdl")) PrecacheModel("models/infected/witch_bride.mdl");
  13.    
  14.     R = CreateConVar("vR", "255", "RGB", FCVAR_NONE);
  15.     G = CreateConVar("vG", "255", "RGB", FCVAR_NONE);
  16.     B = CreateConVar("vB", "255", "RGB", FCVAR_NONE);
  17.     A = CreateConVar("vA", "255", "ALPHA", FCVAR_NONE);
  18. }
  19.  
  20. public OnPluginStart()
  21. {
  22.     HookEvent("witch_spawn", hWitchSpawned);
  23. }
  24.  
  25. public Action hWitchSpawned(Handle:event, const String:name[], bool:dontBroadcast)
  26. {
  27.     new Witch = GetEventInt(event, "witchid");
  28.     new entity = CreateEntityByName("beam_spotlight");
  29.     if(IsValidEntity(entity))
  30.     {
  31.         float flOrigin[3], flAngles[3];
  32.  
  33.         GetEntPropVector(Witch, Prop_Send, "m_vecOrigin", flOrigin);
  34.         GetEntPropVector(Witch, Prop_Send, "m_angRotation", flAngles);
  35.        
  36.         for (int iLight = 0; iLight < 2; iLight++)
  37.         {
  38.             vLightProp(Witch, iLight, flOrigin, flAngles);
  39.         }
  40.        
  41.     }
  42. }
  43.  
  44. static void vLightProp(int Witch, int light, float origin[3], float angles[3])
  45. {
  46.     g_iLight[light] = CreateEntityByName("beam_spotlight");
  47.     DispatchKeyValueVector(g_iLight[light], "origin", origin);
  48.     DispatchKeyValueVector(g_iLight[light], "angles", angles);
  49.    
  50.     SetEntityRenderColor(g_iLight[light], GetConVarInt(R), GetConVarInt(G), GetConVarInt(B), GetConVarInt(A));
  51.     DispatchKeyValue(g_iLight[light], "spotlightwidth", "6");
  52.     DispatchKeyValue(g_iLight[light], "spotlightlength", "50");
  53.     DispatchKeyValue(g_iLight[light], "spawnflags", "3");
  54.  
  55.     DispatchKeyValue(g_iLight[light], "maxspeed", "100");
  56.     DispatchKeyValue(g_iLight[light], "HDRColorScale", "0.4");
  57.     DispatchKeyValue(g_iLight[light], "fadescale", "1");
  58.     DispatchKeyValue(g_iLight[light], "fademindist", "-1");
  59.  
  60.     vSetEntityParent(g_iLight[light], Witch);
  61.  
  62.     switch (light)
  63.     {
  64.         case 0:
  65.         {
  66.             SetVariantString("reye");
  67.             vSetVector(angles, 0.0, 0.0, 0.0);
  68.         }
  69.         case 1:
  70.         {
  71.             SetVariantString("leye");
  72.             vSetVector(angles, 0.0, 0.0, 0.0);
  73.         }
  74.     }
  75.  
  76.     AcceptEntityInput(g_iLight[light], "SetParentAttachment");
  77.     AcceptEntityInput(g_iLight[light], "Enable");
  78.     AcceptEntityInput(g_iLight[light], "DisableCollision");
  79.  
  80.     SetEntPropEnt(g_iLight[light], Prop_Send, "m_hOwnerEntity", Witch);
  81.     TeleportEntity(g_iLight[light], NULL_VECTOR, angles, NULL_VECTOR);
  82.     DispatchSpawn(g_iLight[light]);
  83. }
  84.  
  85. stock void vSetEntityParent(int entity, int parent)
  86. {
  87.     SetVariantString("!activator");
  88.     AcceptEntityInput(entity, "SetParent", parent);
  89. }
  90.  
  91. stock void vSetVector(float target[3], float x, float y, float z)
  92. {
  93.     target[0] = x;
  94.     target[1] = y;
  95.     target[2] = z;
  96. }
  97.  
  98. stock bool:bIsSurvivor(int client)
  99. {
  100.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement