Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include sdktools
- #include sdkhooks
- public OnPluginStart()
- {
- HookEvent("witch_spawn", WitchSpawn)
- }
- public Action WitchSpawn(Event event, const char[] name, bool dontBroadcast)
- {
- int witchid = GetClientOfUserId(event.GetInt("witchid"));
- for (int iLight = 0; iLight < 2; iLight++)
- {
- float eyes[3], ang[3];
- GetEntPropVector(witchid, Prop_Send, "m_vecOrigin", eyes);
- GetEntPropVector(witchid, Prop_Send, "m_angRotation", ang);
- eyes[2] += 120.0
- vLightProp(witchid, iLight, eyes, ang);
- }
- }
- static vLightProp(int tank, int light, float origin[3], float angles[3])
- {
- decl String:s_TargetName[32];
- new g_iLight = CreateEntityByName("beam_spotlight");
- if (IsValidEntity(g_iLight))
- {
- FormatEx(s_TargetName, sizeof(s_TargetName), "witch%d", tank);
- DispatchKeyValue(tank, "targetname", s_TargetName)
- DispatchKeyValue(g_iLight, "parentname", s_TargetName)
- DispatchKeyValueVector(g_iLight, "origin", origin);
- DispatchKeyValueVector(g_iLight, "angles", angles);
- DispatchKeyValue(g_iLight, "spotlightwidth", "10");
- DispatchKeyValue(g_iLight, "spotlightlength", "60");
- DispatchKeyValue(g_iLight, "spawnflags", "3");
- DispatchKeyValue(g_iLight, "maxspeed", "100");
- DispatchKeyValue(g_iLight, "HDRColorScale", "0.7");
- DispatchKeyValue(g_iLight, "fadescale", "1");
- DispatchKeyValue(g_iLight, "fademindist", "-1");
- SetVariantString(s_TargetName);
- AcceptEntityInput(tank, "SetParent", g_iLight);
- AcceptEntityInput(g_iLight, "DisableShadow")
- AcceptEntityInput(g_iLight, "Enable");
- AcceptEntityInput(g_iLight, "DisableCollision");
- switch (light)
- {
- case 0:
- {
- SetVariantString("reye");
- }
- case 1:
- {
- SetVariantString("leye");
- }
- }
- TeleportEntity(g_iLight, NULL_VECTOR, angles, NULL_VECTOR);
- DispatchSpawn(g_iLight);
- }
- }
- stock void vSetVector(float target[3], float x, float y, float z)
- {
- target[0] = x;
- target[1] = y;
- target[2] = z;
- }
- stock void vSetEntityParent(int entity, int parent)
- {
- SetVariantString("!activator");
- AcceptEntityInput(entity, "SetParent", parent);
- }
Advertisement
Add Comment
Please, Sign In to add comment