Thread: CollisionHook
View Single Post
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 09-11-2021 , 16:29   Re: CollisionHook
Reply With Quote #132

Quote:
Originally Posted by HarryPotter View Post
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 EntityFromEntityHandlepTouch );
    const 
CBaseEntity *pEntPass EntityFromEntityHandlepPass );
    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 ( IsStaticProppEntTouch ) || IsStaticProppEntPass ) )
    return 
true
__________________

Last edited by Psyk0tik; 09-12-2021 at 02:42.
Psyk0tik is offline