Beispiel #1
0
CClientPed* CClientPedManager::Get ( RpClump * pClump, bool bCheckPlayers )
{
    if ( !pClump ) return NULL;

    CClientPed * pPed = NULL;
    vector < CClientPed* > ::const_iterator iter = m_StreamedIn.begin ();
    for ( ; iter != m_StreamedIn.end (); iter++ )
    {
        pPed = *iter;
        if ( pPed->GetClump () == pClump && ( pPed->GetType () == CCLIENTPED || bCheckPlayers ) )
        {
            return pPed;
        }
    }
    return NULL;
}
Beispiel #2
0
void CPedRPCs::SetPedAnimationProgress ( CClientEntity* pSource, NetBitStreamInterface& bitStream )
{
    // Read out the player and vehicle id
    char szAnimName [ 64 ];
    unsigned char ucAnimSize;
    float fProgress;

    if ( bitStream.Read ( ucAnimSize ) )
    {
        // Grab the ped
        CClientPed * pPed = m_pPedManager->Get ( pSource->GetID (), true );
        if ( pPed )
        {
            if ( ucAnimSize > 0 )
            {
                if ( bitStream.Read ( szAnimName, ucAnimSize ) )
                {
                    szAnimName [ ucAnimSize ] = 0;
                    if ( bitStream.Read ( fProgress ) )
                    {
                        CAnimBlendAssociation* pA = g_pGame->GetAnimManager ()->RpAnimBlendClumpGetAssociation ( pPed->GetClump (), szAnimName );
                        if ( pA )
                        {
                            pA->SetCurrentProgress ( fProgress );
                        }
                    }
                }
            }
            else
            {
                pPed->KillAnimation ();
            }
        }
    }
}