Quote:
Originally Posted by sake
Isn't Orpheu more efficient due to using native Cstrike functions? Or does the Cstrike module just do the same?
|
You should not worry about that. Use just the available natives depending
your needs. Talking efficiency for that is not worth and you waste time.
Ham_GiveAmmo calls
CBasePlayer::GiveAmmo. Unless you have a good reason, Ham is more easy.
Before trying to use these functions, check before what they do, such function for example can be seen in the HLDSK :
PHP Code:
int CBasePlayer::GiveAmmo( int iCount, char *szName, int iMax )
{
if( pev->flags & FL_SPECTATOR || !szName || !g_pGameRules->CanHaveAmmo( this, szName, iMax ) )
{
return -1;
}
int i = 0;
i = GetAmmoIndex( szName );
if( i < 0 || i >= MAX_AMMO_SLOTS )
{
return -1;
}
int iAdd = min( iCount, iMax - m_rgAmmo[i] );
if( iAdd < 1 )
{
return i;
}
m_rgAmmo[ i ] += iAdd;
if( gmsgAmmoPickup ) // make sure the ammo messages have been linked first
{
MESSAGE_BEGIN( MSG_ONE, gmsgAmmoPickup, NULL, ENT( pev ) );
WRITE_BYTE( GetAmmoIndex(szName) ); // ammo ID
WRITE_BYTE( iAdd ); // amount
MESSAGE_END();
}
TabulateAmmo();
return i;
}
PHP Code:
BOOL CGameRules::CanHaveAmmo( CBasePlayer *pPlayer, const char *pszAmmoName, int iMaxCarry )
{
int iAmmoIndex;
if ( pszAmmoName )
{
iAmmoIndex = pPlayer->GetAmmoIndex( pszAmmoName );
if ( iAmmoIndex > -1 )
{
if ( pPlayer->AmmoInventory( iAmmoIndex ) < iMaxCarry )
{
// player has room for more of this type of ammo
return TRUE;
}
}
}
return FALSE;
}
The native
cs_set_user_bpammo sets only the
m_rgAmmo offset.
__________________