View Single Post
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 06-27-2022 , 12:02   Re: How to detect a kill inside smoke?
Reply With Quote #9

PHP Code:
// Result 0: No players
// Result 1: Attacker is inside smoke
// Result 2: Victim is inside smoke
// Result 3: Both are inside smoke
int CStats::InsideSmoke(CBasePlayerPlayerCBasePlayerTargetfloat Distance// 115.0f
{
    
int Result 0;

    if (
g_ReGameFuncs)
    {
        
CGrenadepEntity nullptr;

        while ((
pEntity = (CGrenade*)g_ReGameFuncs->UTIL_FindEntityByString((CBaseEntity*)pEntity"classname""grenade")))
        {
            if (
pEntity->m_bDetonated)
            {
                if (
pEntity->m_SGSmoke 0)
                {
                    if ((
pEntity->m_vSmokeDetonate Player->edict()->v.origin).IsLengthLessThan(Distance))
                    {
                        
Result += 1;
                    }

                    if ((
pEntity->m_vSmokeDetonate Target->edict()->v.origin).IsLengthLessThan(Distance))
                    {
                        
Result += 2;
                    }

                    if (
Result)
                    {
                        return 
Result;
                    }
                }
            }
        }
    }

    return 
Result;

Final code for detect inside, still need a check to behind smoke frags
Thanks for help.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY