View Single Post
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-22-2022 , 17:56   Re: [L4D2]How to detect special infection behavior stuck
Reply With Quote #4

If still actual, I used to use box bounding check:

PHP Code:
#include <sdktools>

public void OnPluginStart()
{
    
RegAdminCmd("sm_stuck"CmdCheckStuckADMFLAG_ROOT"Checks if client stuck");
}

public 
Action CmdCheckStuck(int clientint args)
{
    
PrintToChat(client"Stuck? %b"IsClientStuck(client));
    return 
Plugin_Handled;
}

stock bool IsClientStuck(int iClientfloat vOrigin[3] = {0.00.00.0})
{
    static 
float vMin[3], vMax[3];
    static 
Handle hTrace;
    static 
bool bHit;
    
bHit false;
    
GetClientMins(iClientvMin);
    
GetClientMaxs(iClientvMax);
    if( 
vOrigin[0] == 0.0 && vOrigin[1] == 0.0 && vOrigin[2] == 0.0 )
    {
        
GetClientAbsOrigin(iClientvOrigin);
    }
    
hTrace TR_TraceHullFilterEx(vOriginvOriginvMinvMaxMASK_PLAYERSOLIDTraceRayNoPlayersiClient);
    if (
hTrace != INVALID_HANDLE) {
        
bHit TR_DidHit(hTrace);
        
CloseHandle(hTrace);
    }
    return 
bHit;
}

public 
bool TraceRayNoPlayers(int entityint maskany data)
{
    if(
entity == data || (entity >= && entity <= MaxClients))
    {
        return 
false;
    }
    return 
true;

__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline