Code:
CreateGlow(client)
{
ClientGlow[client] = 0;
new String:Model[PLATFORM_MAX_PATH];
new Float:Origin[3], Float:Angles[3];
// Get the original model path
GetEntPropString(client, Prop_Data, "m_ModelName", Model, sizeof(Model));
// Find the location of the weapon
GetClientEyePosition(client, Origin);
Origin[2] -= 75.0;
GetClientEyeAngles(client, Angles);
new GlowEnt = CreateEntityByName("prop_dynamic_glow");
DispatchKeyValue(GlowEnt, "model", Model);
DispatchKeyValue(GlowEnt, "disablereceiveshadows", "1");
DispatchKeyValue(GlowEnt, "disableshadows", "1");
DispatchKeyValue(GlowEnt, "solid", "0");
DispatchKeyValue(GlowEnt, "spawnflags", "256");
DispatchKeyValue(GlowEnt, "renderamt", "0");
SetEntProp(GlowEnt, Prop_Send, "m_CollisionGroup", 11);
// Spawn and teleport the entity
DispatchSpawn(GlowEnt);
new fEffects = GetEntProp(GlowEnt, Prop_Send, "m_fEffects");
SetEntProp(GlowEnt, Prop_Send, "m_fEffects", fEffects|EF_BONEMERGE|EF_NOSHADOW|EF_NORECEIVESHADOW|EF_PARENT_ANIMATES);
// Give glowing effect to the entity
SetEntProp(GlowEnt, Prop_Send, "m_bShouldGlow", true, true);
SetEntProp(GlowEnt, Prop_Send, "m_nGlowStyle", 1);
SetEntPropFloat(GlowEnt, Prop_Send, "m_flGlowMaxDist", 10000.0);
// Set glowing color
SetVariantColor({255, 255, 255, 255});
AcceptEntityInput(GlowEnt, "SetGlowColor");
// Set the activator and group the entity
SetVariantString("!activator");
AcceptEntityInput(GlowEnt, "SetParent", client);
SetVariantString("primary");
AcceptEntityInput(GlowEnt, "SetParentAttachment", GlowEnt, GlowEnt, 0);
AcceptEntityInput(GlowEnt, "TurnOn");
SetEntPropEnt(GlowEnt, Prop_Send, "m_hOwnerEntity", client);
SDKHook(GlowEnt, SDKHook_SetTransmit, Hook_ShouldSeeGlow);
ClientGlow[client] = GlowEnt;
}