Исходник Animated bullet tracer

Участник
Статус
Оффлайн
Регистрация
19 Апр 2020
Сообщения
1,171
Реакции[?]
314
Поинты[?]
152K
C++:
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

#include "bullet_tracers.h"
#include "..\..\sdk\misc\BeamInfo_t.hpp"
#include "..\ragebot\aim.h"
#include "..\..\utils\ctx.hpp"
#include "..\misc\logs.h"

void bullettracers::draw_beam(bool local_tracer, const Vector& src, const Vector& end, Color color, bool nade)
{
    if (src == ZERO)
        return;

    BeamInfo_t beam_info;
    beam_info.m_vecStart = src;

    if (local_tracer)
        beam_info.m_vecStart.z -= 2.0f;

    beam_info.m_vecEnd = end;
    beam_info.m_nType = TE_BEAMPOINTS;
    beam_info.m_pszModelName = nade ? crypt_str("sprites/physbeam.vmt") : crypt_str("sprites/physbeam.vmt");
    beam_info.m_nModelIndex = -1;
    beam_info.m_flHaloScale = 0.0f;
    beam_info.m_flLife = nade ? 0.01f : 4.f;
    beam_info.m_flWidth = 1.0f;
    beam_info.m_flEndWidth = 1.0f;
    beam_info.m_flFadeLength = 0.0f;
    beam_info.m_flAmplitude = 2.0f;
    beam_info.m_flBrightness = (float)color.a();
    beam_info.m_flSpeed = 1.2f;
    beam_info.m_nStartFrame = 0;
    beam_info.m_flFrameRate = 0.f;
    beam_info.m_flRed = (float)color.r();
    beam_info.m_flGreen = (float)color.g();
    beam_info.m_flBlue = (float)color.b();
    beam_info.m_nSegments = 2;
    beam_info.m_bRenderable = true;
    beam_info.m_nFlags = FBEAM_ONLYNOISEONCE | FBEAM_NOTILE | FBEAM_HALOBEAM;

    auto beam = m_viewrenderbeams()->CreateBeamPoints(beam_info);

    if (beam)
        m_viewrenderbeams()->DrawBeam(beam);
}

void bullettracers::events(IGameEvent* event)
{
    auto event_name = event->GetName();

    if (!strcmp(event_name, crypt_str("bullet_impact")))
    {
        auto user_id = event->GetInt(crypt_str("userid"));
        auto user = m_engine()->GetPlayerForUserID(user_id);

        auto e = static_cast<player_t*>(m_entitylist()->GetClientEntity(user));

        if (e->valid(false))
        {
            if (e == g_ctx.local())
            {
                auto new_record = true;
                Vector position(event->GetFloat(crypt_str("x")), event->GetFloat(crypt_str("y")), event->GetFloat(crypt_str("z")));

                for (auto& current : impacts)
                {
                    if (e == current.e)
                    {
                        new_record = false;

                        current.impact_position = position;
                        current.time = m_globals()->m_curtime;
                    }
                }

                if (new_record)
                    impacts.push_back(
                        impact_data
                        {
                            e,
                            position,
                            m_globals()->m_curtime
                        });
            }
            else if (e->m_iTeamNum() != g_ctx.local()->m_iTeamNum())
            {
                auto new_record = true;
                Vector position(event->GetFloat(crypt_str("x")), event->GetFloat(crypt_str("y")), event->GetFloat(crypt_str("z")));

                for (auto& current : impacts)
                {
                    if (e == current.e)
                    {
                        new_record = false;

                        current.impact_position = position;
                        current.time = m_globals()->m_curtime;
                    }
                }

                if (new_record)
                    impacts.push_back(
                        impact_data
                        {
                            e,
                            position,
                            m_globals()->m_curtime
                        });
            }
        }
    }
}

void bullettracers::draw_beams()
{
    if (impacts.empty())
        return;

    while (!impacts.empty())
    {
        if (impacts.begin()->impact_position.IsZero()) //-V807
        {
            impacts.erase(impacts.begin());
            continue;
        }

        if (fabs(m_globals()->m_curtime - impacts.begin()->time) > 4.0f) //-V807
        {
            impacts.erase(impacts.begin());
            continue;
        }

        if (!impacts.begin()->e->valid(false))
        {
            impacts.erase(impacts.begin());
            continue;
        }

        if (TIME_TO_TICKS(m_globals()->m_curtime) > TIME_TO_TICKS(impacts.begin()->time))
        {
            auto color = g_cfg.esp.enemy_bullet_tracer_color;

            if (impacts.begin()->e == g_ctx.local())
            {
                if (!g_cfg.esp.bullet_tracer)
                {
                    impacts.erase(impacts.begin());
                    continue;
                }

                color = g_cfg.esp.bullet_tracer_color;
            }
            else if (!g_cfg.esp.enemy_bullet_tracer)
            {
                impacts.erase(impacts.begin());
                continue;
            }
            Vector project;

            draw_beam(impacts.begin()->e == g_ctx.local(), impacts.begin()->e == g_ctx.local() ? aim::get().last_shoot_position : impacts.begin()->e->get_shoot_position(), impacts.begin()->impact_position, color, false);
            impacts.erase(impacts.begin());
            continue;
        }

        break;
    }
}

#pragma once

#include "..\..\includes.hpp"
#include "..\..\sdk\structs.hpp"

class bullettracers : public singleton <bullettracers>
{


    struct impact_data
    {
        player_t* e;
        Vector impact_position;
        float time;
    };

    std::vector <impact_data> impacts;
public:
    void draw_beam(bool local_tracer, const Vector& src, const Vector& end, Color color, bool nade);
    void events(IGameEvent* event);
    void draw_beams();
};
1629579197165.png
 
Начинающий
Статус
Оффлайн
Регистрация
20 Май 2019
Сообщения
143
Реакции[?]
21
Поинты[?]
0
Код:
f (src == ZERO)
        return;

    BeamInfo_t beam_info;
    beam_info.m_vecStart = src;

    if (local_tracer)
        beam_info.m_vecStart.z -= 2.0f;

    beam_info.m_vecEnd = end;
    beam_info.m_nType = TE_BEAMPOINTS;
    beam_info.m_pszModelName = nade ? crypt_str("sprites/physbeam.vmt") : crypt_str("sprites/physbeam.vmt");
    beam_info.m_nModelIndex = -1;
    beam_info.m_flHaloScale = 0.0f;
    beam_info.m_flLife = nade ? 0.01f : 4.f;
    beam_info.m_flWidth = 1.0f;
    beam_info.m_flEndWidth = 1.0f;
    beam_info.m_flFadeLength = 0.0f;
    beam_info.m_flAmplitude = 2.0f;
    beam_info.m_flBrightness = (float)color.a();
    beam_info.m_flSpeed = 1.2f;
    beam_info.m_nStartFrame = 0;
    beam_info.m_flFrameRate = 0.f;
    beam_info.m_flRed = (float)color.r();
    beam_info.m_flGreen = (float)color.g();
    beam_info.m_flBlue = (float)color.b();
    beam_info.m_nSegments = 2;
    beam_info.m_bRenderable = true;
    beam_info.m_nFlags = FBEAM_ONLYNOISEONCE | FBEAM_NOTILE | FBEAM_HALOBEAM;

    auto beam = m_viewrenderbeams()->CreateBeamPoints(beam_info);

    if (beam)
        m_viewrenderbeams()->DrawBeam(beam);
you can just share this
 
Начинающий
Статус
Оффлайн
Регистрация
12 Ноя 2017
Сообщения
39
Реакции[?]
14
Поинты[?]
0
sprites / physbeam.vmt <- only this would do the job, even knowing that this post is totally useless, once we got multiple sources with bullet tracers implementation.
 
Начинающий
Статус
Оффлайн
Регистрация
20 Май 2019
Сообщения
143
Реакции[?]
21
Поинты[?]
0
sprites / physbeam.vmt <- only this would do the job, even knowing that this post is totally useless, once we got multiple sources with bullet tracers implementation.
não, não seria se ele apenas sprites / physbeam.vmt compartilhasse, mas é realmente inútil
and can you write in english?
 
Участник
Статус
Оффлайн
Регистрация
30 Авг 2020
Сообщения
660
Реакции[?]
396
Поинты[?]
16K
АПЪХАВАПВХАЪХЗПЪХЗВАЪХЗП что это
1629589274742.png
C++:
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

#include "bullet_tracers.h"
#include "..\..\sdk\misc\BeamInfo_t.hpp"
#include "..\ragebot\aim.h"
#include "..\..\utils\ctx.hpp"
#include "..\misc\logs.h"

void bullettracers::draw_beam(bool local_tracer, const Vector& src, const Vector& end, Color color, bool nade)
{
    if (src == ZERO)
        return;

    BeamInfo_t beam_info;
    beam_info.m_vecStart = src;

    if (local_tracer)
        beam_info.m_vecStart.z -= 2.0f;

    beam_info.m_vecEnd = end;
    beam_info.m_nType = TE_BEAMPOINTS;
    beam_info.m_pszModelName = nade ? crypt_str("sprites/physbeam.vmt") : crypt_str("sprites/physbeam.vmt");
    beam_info.m_nModelIndex = -1;
    beam_info.m_flHaloScale = 0.0f;
    beam_info.m_flLife = nade ? 0.01f : 4.f;
    beam_info.m_flWidth = 1.0f;
    beam_info.m_flEndWidth = 1.0f;
    beam_info.m_flFadeLength = 0.0f;
    beam_info.m_flAmplitude = 2.0f;
    beam_info.m_flBrightness = (float)color.a();
    beam_info.m_flSpeed = 1.2f;
    beam_info.m_nStartFrame = 0;
    beam_info.m_flFrameRate = 0.f;
    beam_info.m_flRed = (float)color.r();
    beam_info.m_flGreen = (float)color.g();
    beam_info.m_flBlue = (float)color.b();
    beam_info.m_nSegments = 2;
    beam_info.m_bRenderable = true;
    beam_info.m_nFlags = FBEAM_ONLYNOISEONCE | FBEAM_NOTILE | FBEAM_HALOBEAM;

    auto beam = m_viewrenderbeams()->CreateBeamPoints(beam_info);

    if (beam)
        m_viewrenderbeams()->DrawBeam(beam);
}

void bullettracers::events(IGameEvent* event)
{
    auto event_name = event->GetName();

    if (!strcmp(event_name, crypt_str("bullet_impact")))
    {
        auto user_id = event->GetInt(crypt_str("userid"));
        auto user = m_engine()->GetPlayerForUserID(user_id);

        auto e = static_cast<player_t*>(m_entitylist()->GetClientEntity(user));

        if (e->valid(false))
        {
            if (e == g_ctx.local())
            {
                auto new_record = true;
                Vector position(event->GetFloat(crypt_str("x")), event->GetFloat(crypt_str("y")), event->GetFloat(crypt_str("z")));

                for (auto& current : impacts)
                {
                    if (e == current.e)
                    {
                        new_record = false;

                        current.impact_position = position;
                        current.time = m_globals()->m_curtime;
                    }
                }

                if (new_record)
                    impacts.push_back(
                        impact_data
                        {
                            e,
                            position,
                            m_globals()->m_curtime
                        });
            }
            else if (e->m_iTeamNum() != g_ctx.local()->m_iTeamNum())
            {
                auto new_record = true;
                Vector position(event->GetFloat(crypt_str("x")), event->GetFloat(crypt_str("y")), event->GetFloat(crypt_str("z")));

                for (auto& current : impacts)
                {
                    if (e == current.e)
                    {
                        new_record = false;

                        current.impact_position = position;
                        current.time = m_globals()->m_curtime;
                    }
                }

                if (new_record)
                    impacts.push_back(
                        impact_data
                        {
                            e,
                            position,
                            m_globals()->m_curtime
                        });
            }
        }
    }
}

void bullettracers::draw_beams()
{
    if (impacts.empty())
        return;

    while (!impacts.empty())
    {
        if (impacts.begin()->impact_position.IsZero()) //-V807
        {
            impacts.erase(impacts.begin());
            continue;
        }

        if (fabs(m_globals()->m_curtime - impacts.begin()->time) > 4.0f) //-V807
        {
            impacts.erase(impacts.begin());
            continue;
        }

        if (!impacts.begin()->e->valid(false))
        {
            impacts.erase(impacts.begin());
            continue;
        }

        if (TIME_TO_TICKS(m_globals()->m_curtime) > TIME_TO_TICKS(impacts.begin()->time))
        {
            auto color = g_cfg.esp.enemy_bullet_tracer_color;

            if (impacts.begin()->e == g_ctx.local())
            {
                if (!g_cfg.esp.bullet_tracer)
                {
                    impacts.erase(impacts.begin());
                    continue;
                }

                color = g_cfg.esp.bullet_tracer_color;
            }
            else if (!g_cfg.esp.enemy_bullet_tracer)
            {
                impacts.erase(impacts.begin());
                continue;
            }
            Vector project;

            draw_beam(impacts.begin()->e == g_ctx.local(), impacts.begin()->e == g_ctx.local() ? aim::get().last_shoot_position : impacts.begin()->e->get_shoot_position(), impacts.begin()->impact_position, color, false);
            impacts.erase(impacts.begin());
            continue;
        }

        break;
    }
}

#pragma once

#include "..\..\includes.hpp"
#include "..\..\sdk\structs.hpp"

class bullettracers : public singleton <bullettracers>
{


    struct impact_data
    {
        player_t* e;
        Vector impact_position;
        float time;
    };

    std::vector <impact_data> impacts;
public:
    void draw_beam(bool local_tracer, const Vector& src, const Vector& end, Color color, bool nade);
    void events(IGameEvent* event);
    void draw_beams();
};
Посмотреть вложение 167507
ты хоть что-то своими ручками напишешь? А ты же яп ни один не знаешь :roflanEbalo:
 
Последнее редактирование:
Эксперт
Статус
Оффлайн
Регистрация
30 Дек 2019
Сообщения
1,970
Реакции[?]
958
Поинты[?]
19K
Олдфаг
Статус
Оффлайн
Регистрация
4 Янв 2020
Сообщения
2,994
Реакции[?]
1,275
Поинты[?]
5K
ну видимо на нейд он юзает physbeam а не на нейд physbeam, ты просто не видишь отличий, там секретный код
там прост на кириллице написано, а сам спрайт через лоадер подкачивается чтоб не спастили
 
Забаненный
Статус
Оффлайн
Регистрация
23 Авг 2020
Сообщения
2,110
Реакции[?]
597
Поинты[?]
10K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
1629623474132.png
Там y или e русская.
Секрет раскрыт
 
Олдфаг
Статус
Оффлайн
Регистрация
4 Янв 2020
Сообщения
2,994
Реакции[?]
1,275
Поинты[?]
5K
Забаненный
Статус
Оффлайн
Регистрация
23 Авг 2020
Сообщения
2,110
Реакции[?]
597
Поинты[?]
10K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Сверху Снизу