Use this to check if an ent is inside of another ent.
iFirstIndex should be the player index if it's about your exmaple and iSecondIndex the cube zone index.
PHP Code:
stock bool: EntInsideEnt( iFirstIndex, iSecondIndex)
{
new Float: fEntMin [ 3 ]; pev( iFirstIndex, pev_absmin, fEntMin )
new Float: fEntMax [ 3 ]; pev( iFirstIndex, pev_absmax, fEntMax )
new Float: fTargetMin [ 3 ]; pev( iSecondIndex, pev_absmin, fTargetMin )
new Float: fTargetMax [ 3 ]; pev( iSecondIndex, pev_absmax, fTargetMax )
new Float: v_fDistance [ 3 ]
for( new i; i < 3; i++ )
{
if( fEntMin[ i ] > fTargetMax[ i ] )
{
v_fDistance[ i ] = fEntMin[ i ] - fTargetMax[ i ]
}
else if( fTargetMin[ i ] > fEntMax[ i ] )
{
v_fDistance[ i ] = fTargetMin[ i ] - fEntMax[ i ]
}
}
if( vector_length( v_fDistance ) )
{
return false
}
else
{
return true
}
return false
}
__________________