Quote:
Originally Posted by HarryPotter
l4d1 windows server crash, hope someone can help
sm1.10 + DHooks 2.2.0-detours17
|
Your setup is wrong. You need to understand that not every entity handle pointer passed to the two params will be a CBaseEntity pointer. You'll have to figure out a way to check if they are static props or not. When one of the params is a static prop, you'll want to return early to avoid crashes. You'll also want to change the param types from "cbaseentity" to "int" so DHooks doesn't convert them to entity indexes, which is also why you're getting crashes.
This is the code in the SDK:
PHP Code:
bool PassServerEntityFilter( const IHandleEntity *pTouch, const IHandleEntity *pPass )
{
if ( !pPass )
return true;
if ( pTouch == pPass )
return false;
const CBaseEntity *pEntTouch = EntityFromEntityHandle( pTouch );
const CBaseEntity *pEntPass = EntityFromEntityHandle( pPass );
if ( !pEntTouch || !pEntPass )
return true;
// don't clip against own missiles
if ( pEntTouch->GetOwnerEntity() == pEntPass )
return false;
// don't clip against owner
if ( pEntPass->GetOwnerEntity() == pEntTouch )
return false;
return true;
}
You'll want to check for something like this in your detour:
PHP Code:
if ( IsStaticProp( pEntTouch ) || IsStaticProp( pEntPass ) )
return true;
__________________