here is a stock I created awhile ago for parenting and using Attachements:
Code:
public void parentEntity(int child, int parent, const char[] attachment) {
SetVariantString("!activator");
AcceptEntityInput(child, "SetParent", parent, child, 0);
if(!StrEqual(attachment, "", false)) {
SetVariantString(attachment);
AcceptEntityInput(child, "SetParentAttachment", child, child, 0);
}
}
to parent to an entity use: parentEntity(child, parent, "");
to parent to an entity with a specific attachement point use: parentEntity(child, parent, "forward");