Exemple #1
0
CWeapon * CPedSA::GiveWeapon ( eWeaponType weaponType, unsigned int uiAmmo, eWeaponSkill skill )
{
    if ( weaponType != WEAPONTYPE_UNARMED )
    {
        CWeaponInfo* pInfo = pGame->GetWeaponInfo ( weaponType, skill );
        if ( pInfo )
        {
            int iModel = pInfo->GetModel();

            if ( iModel )
            {
                CModelInfo * pWeaponModel = pGame->GetModelInfo ( iModel );
                if ( pWeaponModel )
                {
                    pWeaponModel->Request ( BLOCKING, "CPedSA::GiveWeapon" );
                    pWeaponModel->MakeCustomModel ();
                }
            }
            // If the weapon is satchels, load the detonator too
            if ( weaponType == WEAPONTYPE_REMOTE_SATCHEL_CHARGE )
            {
                /*int iModel = pGame->GetWeaponInfo ( WEAPONTYPE_DETONATOR )->GetModel();
                if ( iModel )
                {
                    CModelInfo * pWeaponModel = pGame->GetModelInfo ( iModel );
                    if ( pWeaponModel )
                    {
                        pWeaponModel->Request ( true, true );
                    }
                }*/
                // Load the weapon and give it properly so getPedWeapon shows the weapon is there.
                GiveWeapon( WEAPONTYPE_DETONATOR, 1, WEAPONSKILL_STD );
            }
        }
    }

    DWORD dwReturn = 0;
    DWORD dwFunc = FUNC_GiveWeapon;
    DWORD dwThis = (DWORD)this->GetInterface();
    _asm
    {
        mov     ecx, dwThis
        push    1
        push    uiAmmo
        push    weaponType
        call    dwFunc
        mov     dwReturn, eax
    }

    CWeapon* pWeapon = GetWeapon ( (eWeaponSlot)dwReturn );

    return pWeapon;
}
Exemple #2
0
bool CClientModelRequestManager::RequestBlocking ( unsigned short usModelID )
{
    // Grab the model info
    CModelInfo* pInfo = g_pGame->GetModelInfo ( usModelID );
    if ( pInfo )
    {
        pInfo->Request ( TRUE, TRUE );
        pInfo->MakeCustomModel ();
        return true;
    }

    // Bad model ID probably.
    return false;
}
bool CClientModelRequestManager::RequestBlocking ( unsigned short usModelID, const char* szTag )
{
    // Grab the model info
    CModelInfo* pInfo = g_pGame->GetModelInfo ( usModelID );
    if ( pInfo )
    {
        pInfo->Request ( BLOCKING, szTag );
        if ( pInfo->IsLoaded () )
        {
            pInfo->MakeCustomModel ();
            return true;
        }
        OutputDebugLine ( SString ( "[Models] RequestBlocking failed for id %d", usModelID ) );
    }

    // Bad model ID probably.
    return false;
}