Trace

RawLine

Parameters: int skip_index, vec3 start, vec3 end, unsigned int mask, int type

  • Fraction info:

    • 1.0 means it didnt hit anything, 0.5 means it hit something half way through, 0.1 is hit

  • Skip index:

    • skips a certain entity, can be 0 to not skip any entity.

  • Mask:

    • filters what should and shouldn't be taken into consideration when tracing

    • masks can be combined, example below:

    • A bullet would be 0x4600400b ( CONTENTS_SOLID + CONTENTS_WINDOW + CONTENTS_GRATE + CONTENTS_MOVEABLE + CONTENTS_MONSTER + CONTENTS_DEBRIS + CONTENTS_HITBOX )

  • Type:

    • 0 = TRACE_EVERYTHING

    • 1 = TRACE_WORLD_ONLY

    • 2 = TRACE_ENTITIES_ONLY

        CONTENTS_SOLID                    0x1
        CONTENTS_WINDOW                       0x2
        CONTENTS_AUX                      0x4
        CONTENTS_GRATE                      0x8
        CONTENTS_SLIME                      0x10
        CONTENTS_WATER                      0x20
        CONTENTS_BLOCKLOS                  0x40
        CONTENTS_OPAQUE                      0x80
        CONTENTS_TESTFOGVOLUME              0x100
        CONTENTS_UNUSED                      0x200
        CONTENTS_BLOCKLIGHT                  0x400
        CONTENTS_TEAM1                      0x800
        CONTENTS_TEAM2                      0x1000
        CONTENTS_IGNORE_NODRAW_OPAQUE     0x2000
        CONTENTS_MOVEABLE                  0x4000
        CONTENTS_AREAPORTAL                  0x8000
        CONTENTS_PLAYERCLIP                  0x10000
        CONTENTS_MONSTERCLIP              0x20000
        CONTENTS_ORIGIN                      0x1000000
        CONTENTS_MONSTER                  0x2000000
        CONTENTS_DEBRIS                      0x4000000
        CONTENTS_DETAIL                      0x8000000
        CONTENTS_TRANSLUCENT              0x10000000
        CONTENTS_LADDER                      0x20000000
        CONTENTS_HITBOX                      0x40000000

Return values: returns entity index and number fraction.

[EN] Used for advanced line tracing. [RU] Используется для расширенной трассировки линий.

Smoke

Parameters: array start, array end

function isBehindSmoke(entity_index)
{
    eyepos = Entity.GetEyePosition(Entity.GetLocalPlayer());
        if (Entity.IsValid(entity_index) && Entity.IsAlive(entity_index) && !Entity.IsDormant(entity_index)){
            hitbox_pos = Entity.GetHitboxPosition(entity_index, 0);
            result = Trace.Smoke(eyepos, hitbox_pos);
                if (result == 1)
                {
                    return true
                }
                else
                {
                    return false
                }
        }       
}
function main()
{
    enemies = Entity.GetEnemies()
    for (i=0; i < enemies.length; i++)
    {
        if (isBehindSmoke(enemies[i]))
        {
            Cheat.Print("Enemy: " + Entity.GetName(enemies[i])+ " is behind smoke\n")
        }
    }
}
Cheat.RegisterCallback("CreateMove", "main");

Return values: returns 1 if there was smoke.

[EN] Used to check if smoke is between two points. [RU] Используется для проверки наличия дыма между двумя точками.

Bullet

Parameters: int ent_index, int target, array start, array end

function isVisible()
{

    localPlayer_index = Entity.GetLocalPlayer();
    localPlayer_eyepos = Entity.GetEyePosition(localPlayer_index);
    enemies = Entity.GetEnemies();
    for ( i = 0; i < enemies.length; i++)
    {
        if (Entity.IsValid(enemies[i]) == true && Entity.IsAlive(enemies[i]) && Entity.IsDormant(enemies[i]) == false)
        {
        hitbox_pos = Entity.GetHitboxPosition(localPlayer_index, 0);
        bot_eyepos = Entity.GetEyePosition(enemies[i])
        
        w2s_s = Render.WorldToScreen(bot_eyepos)
        w2s_e = Render.WorldToScreen(hitbox_pos)
        Render.Line(w2s_s[0], w2s_s[1], w2s_e[0], w2s_e[1], [255, 255, 255, 255])
        Render.String(w2s_s[0], w2s_s[1], 0, "START", [255, 0, 0, 255])
        Render.String(w2s_e[0], w2s_e[1], 0, "END", [255, 0, 0, 255])
        }
    }
}

function cm()
{
    localPlayer_index = Entity.GetLocalPlayer();
    localPlayer_eyepos = Entity.GetEyePosition(localPlayer_index);
    enemies = Entity.GetEnemies();
    for ( i = 0; i < enemies.length; i++)
    {
       if (Entity.IsValid(enemies[i]) == true && Entity.IsAlive(enemies[i]) && Entity.IsDormant(enemies[i]) == false)
        {
        hitbox_pos = Entity.GetHitboxPosition(localPlayer_index, 0);
        bot_eyepos = Entity.GetEyePosition(enemies[i])
        result = Trace.Bullet(enemies[i], localPlayer_index, bot_eyepos, hitbox_pos);
        Cheat.Print("Trace result:: " + Entity.GetName(enemies[i]) + " can see player: " + Entity.GetName(result[0]) + " damage:: " + result[1] + " visible:: " + result[2] + " hitbox :: " + result[3] + "\n")
        }
    }

}
Cheat.RegisterCallback("Draw", "isVisible");
Cheat.RegisterCallback("CreateMove", "cm");

Return values: returns entity index, damage, visibility, and hitbox.

[EN] Used to trace bullet between two entities. [RU] Используется для отслеживания маркера между двумя объектами.

Line

Parameters: int ent_index, array start, array end

Fraction info: 1.0 means it didnt hit anything, 0.5 means it hit something half way through, 0.1 is hit

function isVisible()
{

    localPlayer_index = Entity.GetLocalPlayer();
    localPlayer_eyepos = Entity.GetEyePosition(localPlayer_index);
    enemies = Entity.GetEnemies();
    for ( i = 0; i < enemies.length; i++)
    {
        hitbox_pos = Entity.GetHitboxPosition(enemies[i], 0);
        result = Trace.Line(localPlayer_index, localPlayer_eyepos, hitbox_pos);
        Cheat.Print("Entity: " + Entity.GetName(result[0]) + " fraction: " + result[1] + "\n");
    }

}

Cheat.RegisterCallback("Draw", "isVisible");
// This function will trace line from localplayer eye position to enemy head hitbox position and return whether the enemy is visible or not

Return values: returns entity index and number fraction.

[EN] Used to trace line between point A and B. [RU] Используется для прокладки линии между точками A и B.

Last updated