the entity may not be attachable to another entity!
but i have noticed FollowEntity() in V-developer with predicted_viewmodel like :
PHP Code:
void CEntHost::CreateViewModel( int index )
{
Assert( IsPlayer() );
Assert( index >= 0 && index < MAX_VIEWMODELS );
if ( !IsPlayer() )
return;
if ( GetPlayer()->GetViewModel( index ) )
return;
CPredictedViewModel *vm = (CPredictedViewModel *)CreateEntityByName( "predicted_viewmodel" );
if ( vm ) {
vm->SetAbsOrigin( GetAbsOrigin() );
vm->SetOwner( GetPlayer() );
vm->SetIndex( index );
DispatchSpawn( vm );
vm->FollowEntity( GetPlayer(), false ); //Your Problem Is Here
vm->AddEffects( EF_NODRAW );
GetPlayer()->m_hViewModel.Set( index, vm );
}
}
So This may help :
Quote:
Re: Entity Parenting detection
Success Code for others:
Code:
new childEntity = GetEntPropEnt(targetEntity, Prop_Data, "m_hMoveChild");
new parentEntity = GetEntPropEnt(targetEntity, Prop_Data, "m_hMoveParent");
if -1 means no entity found
otherwise true
|
Quote:
Re: Actually you can check if you successfully attached entity for some attachment
PHP Code:
bool AttachEntity( int entity, int owner, const char[] attachment = NULL_STRING )
{
SetVariantString("!activator");
AcceptEntityInput(entity, "SetParent", owner);
if (!IsNullString(attachment))
{
SetVariantString(attachment);
AcceptEntityInput(entity, "SetParentAttachMent", owner);
if ( GetEntProp(entity, Prop_Data, "m_iParentAttachment") == 0 )
{
LogError("Failed to set attachment");
return false;
}
}
return true;
}
|