Quote:
Originally Posted by TheDS1337
PHP Code:
new active_weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"); if (IsValidEntity(active_weapon)) { new particle = CreateEntityByName("info_particle_system"); if (particle != -1) { DispatchKeyValue(particle, "effect_name", "smoke_trail"); DispatchKeyValue(particle, "start_active", "1"); if (DispatchSpawn(particle)) { ActivateEntity(particle); SetVariantString("!activator"); AcceptEntityInput(particle, "SetParent", active_weapon, particle); SetVariantString("muzzle"); AcceptEntityInput(particle, "SetParentAttachment", active_weapon, particle); } } }
|
The attachment you are looking for is muzzle_flash.
Code:
ActivateEntity(particle);
SetVariantString("!activator");
AcceptEntityInput(particle, "SetParent", active_weapon, particle);
SetVariantString("muzzle_flash");
AcceptEntityInput(particle, "SetParentAttachment", active_weapon, particle);
I can't for the life of me remember but I don't think the player actually carries the weapon entity when they have the weapon active or in inventory so I don't know if this will work. It should always work however when the weapon is not equipped (e.g. on the floor, not picked up in general).
If that doesn't work for the weapon while it is active on the player then try parenting it on the client. The player version of the attachment isn't exactly on the muzzle but you could add a specific offset for the gun types if you are willing to do the extra work or it might even be good enough for your needs.
Code:
ActivateEntity(particle);
SetVariantString("!activator");
AcceptEntityInput(particle, "SetParent", client, particle);
SetVariantString("muzzle_flash");
AcceptEntityInput(particle, "SetParentAttachment", client, particle);
__________________