Quote:
Originally Posted by Entity
PHP Code:
new active_weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"); if (IsValidEntity(active_weapon)) { new particle = CreateEntityByName("info_particle_system"); if (particle != -1) { decl Float:position[3]; GetEntPropVector(active_weapon, Prop_Send, "m_vecOrigin", position); //return Float:{0.0, 0.0, 0.0} DispatchKeyValueVector(particle, "origin", position); DispatchKeyValue(particle, "effect_name", "smoke_trail"); DispatchKeyValue(particle, "start_active", "1"); if (DispatchSpawn(particle)) { ActivateEntity(particle); SetVariantString("!activator"); AcceptEntityInput(particle, "SetParent", active_weapon); SetVariantString("0"); AcceptEntityInput(particle, "SetParentAttachment", particle); } } }
I tried...
|
I think they meant that you don't need to set the origin manually, it'll be updated automatically after SetParantAttachement, from wiki:
PHP Code:
SetParentAttachment
Note: Entities must be parented before being sent this input. Use at least a 0.01 second delay between SetParent and SetParentAttachment inputs.
You can also fire a SetParentAttachment input at the child-entity to attach it to a specific attachment point on its parent. The parameter is the name of the attachment point.
The Child instantly teleports to the attachment point. This is the only method which does not maintain the offset.
You may try this, found it after few secs of search:
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);
}
}
}