Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #pragma newdecls required
- #include <sourcemod>
- #include <sdktools>
- public Plugin myinfo=
- {
- name = "WitchLight",
- author = "BHaType && (Thanks dragokas for help)",
- description = "Неплохое улучшения визуализации глаз вичек.",
- version = "0.0.8.5",
- url = "N/A"
- };
- /*
- 0.0.8.4
- - Added check for valid witch entity.
- - Removed unused "beam_spotlight" entity creation.
- - Removed model precaching. Why do I need this?
- - Removed unused stock.
- 0.0.8.3
- - Removed ConVars, removed alpha because it is not suitable.
- - Added color random by special scheme (previous version with HDRColorScale 0.6 is too bright).
- - Converted to methodmaps.
- */
- int g_iLight[3];
- public void OnMapStart()
- {
- //if (!IsModelPrecached("models/infected/witch.mdl")) PrecacheModel("models/infected/witch.mdl");
- //if (!IsModelPrecached("models/infected/witch_bride.mdl")) PrecacheModel("models/infected/witch_bride.mdl");
- }
- public void OnPluginStart()
- {
- HookEvent("witch_spawn", hWitchSpawned);
- }
- public Action hWitchSpawned(Event event, const char[] name, bool dontBroadcast)
- {
- int Witch = event.GetInt("witchid");
- if (Witch && IsValidEntity(Witch)) {
- //int entity = CreateEntityByName("beam_spotlight");
- //if(entity != -1 && IsValidEntity(entity))
- {
- float flOrigin[3], flAngles[3];
- GetEntPropVector(Witch, Prop_Send, "m_vecOrigin", flOrigin);
- GetEntPropVector(Witch, Prop_Send, "m_angRotation", flAngles);
- for (int iLight = 0; iLight < 2; iLight++)
- {
- vLightProp(Witch, iLight, flOrigin, flAngles);
- }
- }
- }
- }
- static void vLightProp(int Witch, int light, float origin[3], float angles[3])
- {
- int color[3];
- color[0] = GetRandomInt(50, 100);
- color[1] = GetRandomInt(50, 100);
- color[2] = GetRandomInt(50, 100);
- color[GetRandomInt(0,2)] = GetRandomInt(100, 140);
- color[GetRandomInt(0,2)] = 0;
- g_iLight[light] = CreateEntityByName("beam_spotlight");
- DispatchKeyValueVector(g_iLight[light], "origin", origin);
- DispatchKeyValueVector(g_iLight[light], "angles", angles);
- SetEntityRenderColor(g_iLight[light], color[0], color[1], color[2], 255);
- DispatchKeyValue(g_iLight[light], "spotlightwidth", "10");
- DispatchKeyValue(g_iLight[light], "spotlightlength", "120");
- DispatchKeyValue(g_iLight[light], "spawnflags", "3");
- DispatchKeyValue(g_iLight[light], "maxspeed", "100");
- DispatchKeyValue(g_iLight[light], "HDRColorScale", "0.6");
- DispatchKeyValue(g_iLight[light], "fadescale", "1");
- DispatchKeyValue(g_iLight[light], "fademindist", "-1");
- vSetEntityParent(g_iLight[light], Witch);
- switch (light)
- {
- case 0:
- {
- SetVariantString("reye");
- vSetVector(angles, 0.0, 0.0, 0.0);
- }
- case 1:
- {
- SetVariantString("leye");
- vSetVector(angles, 0.0, 0.0, 0.0);
- }
- }
- AcceptEntityInput(g_iLight[light], "SetParentAttachment");
- AcceptEntityInput(g_iLight[light], "Enable");
- AcceptEntityInput(g_iLight[light], "DisableCollision");
- SetEntPropEnt(g_iLight[light], Prop_Send, "m_hOwnerEntity", Witch);
- TeleportEntity(g_iLight[light], NULL_VECTOR, angles, NULL_VECTOR);
- DispatchSpawn(g_iLight[light]);
- }
- stock void vSetEntityParent(int entity, int parent)
- {
- SetVariantString("!activator");
- AcceptEntityInput(entity, "SetParent", parent);
- }
- stock void vSetVector(float target[3], float x, float y, float z)
- {
- target[0] = x;
- target[1] = y;
- target[2] = z;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement