Эксклюзив команды свечения бомбы

Сообщения
68
Реакции
0
Я использую след от гранаты бомбы и плагин свечения. В этом плагине есть настройка cvar как «показать личное для вашей команды». Когда я активирую эту настройку cvar, товарищу по команде продолжает показываться только след бомбы. Один из противостоящей команды не видит следа, но видит свечение бомбы. Моя просьба здесь - установить свечение бомбы так, чтобы его мог видеть только мой товарищ по команде.

Итак, что я сделал для этого?

Строка кода, которая заставляет светиться бомбу:
Код:
             new Float: fColor[3]; 
    
                        fColor[0] = float(iRed);
                        fColor[1] = float(iGreen);
                        fColor[2] = float(iBlue);
                        set_entvar(pEntity, var_rendermode, kRenderGlow);
                        set_entvar(pEntity, var_renderamt, 1.0);
                        set_entvar(pEntity, var_rendercolor, fColor);
                        set_entvar(pEntity, var_renderfx, kRenderFxGlowShell);
Часть состояния 1 — это часть настройки cvar, которую я хочу, и я вставил эту строку кода здесь.

Код:
switch( clamp(g_Cvar[GT_STATUS], 0, 3) )
    {
        case 1:
        {
            new CsTeams:iOwnerTeam = get_member(pPlayer, m_iTeam);
            
            for( new iPlayer=1; iPlayer<=MaxClients; iPlayer++ )
            {
                if( is_user_connected(iPlayer) )
                {
                    if( get_member(iPlayer, m_iTeam) == iOwnerTeam )
                    {
                        new Float: fColor[3]; 
    
                        fColor[0] = float(iRed);
                        fColor[1] = float(iGreen);
                        fColor[2] = float(iBlue);
                        set_entvar(pEntity, var_rendermode, kRenderGlow);
                        set_entvar(pEntity, var_renderamt, 1.0);
                        set_entvar(pEntity, var_rendercolor, fColor);
                        set_entvar(pEntity, var_renderfx, kRenderFxGlowShell);
                        message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                        write_byte(TE_BEAMFOLLOW);
                        write_short(pEntity);
                        write_short(g_iSpriteArrow);
                        write_byte(15);
                        write_byte(7);
                        write_byte(iRed);
                        write_byte(iGreen);
                        write_byte(iBlue);
                        write_byte(191);                       
                        message_end();
                        
                        if( iTemp )
                        {
                            message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                            write_byte(TE_BEAMFOLLOW);
                            write_short(pEntity);
                            write_short(g_iSpriteLine);
                            write_byte(15);
                            write_byte(1);
                            switch( iOwnerTeam )
                            {
                                case TEAM_TERRORIST:
                                {
                                    write_byte(255);
                                    write_byte(0);
                                    write_byte(0);       
                                }
                                case TEAM_CT:
                                {
                                    write_byte(0);
                                    write_byte(0);
                                    write_byte(255);
                                }
                                default:
                                {
                                    write_byte(127);
                                    write_byte(127);
                                    write_byte(127);
                                }
                            }
                            write_byte(191);
                            message_end();
                        }
                    }
                }
            }
        }

Хотя это так, кто-то из противоположной команды все еще может видеть свечение моей бомбы, как вы думаете, где я ошибся?
 

Garey

ninjaCow
Сообщения
440
Реакции
1,094
Помог
11 раз(а)
в фулпаке ставить Glow а не глобально.
 
Сообщения
1,560
Реакции
1,572
Помог
2 раз(а)
Я не совсем понимаю, что вы имеете в виду?
Что - бы что было в поле зрения для конкретного игрока.т.е. команды - нужно подключение фуллпака.
В нашем случаи - это спрайт
 
Сообщения
594
Реакции
350
Предупреждения
1
Помог
9 раз(а)
MayroN, какой спрайт, речь идёт о glow эффекте entity.
 
Сообщения
68
Реакции
0
MayroN, какой спрайт, речь идёт о glow эффекте entity.
Проблема не в том, что свечение не работает, я просто поделился с вами частью плагина. Это все здесь:
Код:
// ----------------------------------------- CONFIG START -----------------------------------------

// If you are having problems, that not everyone who should see the trail is seeing them, that can
// be due to message type and ping. Using "MSG_ONE_UNRELIABLE" and "MSG_BROADCAST" is better for server
// stability, however using "MSG_ONE" and "MSG_ALL" garanties that client will recieve the update.
#define MSG_TYPE_ALONE MSG_ONE // default: (uncommented)
//#define MSG_TYPE_ALONE MSG_ONE_UNRELIABLE // default: (commented)
#define MSG_TYPE_ALL MSG_ALL // default: (uncommented)
//#define MSG_TYPE_ALL MSG_BROADCAST // default: (commented)


#define CREATE_CONFIG  // default: (uncommented)
// ------------------------------------------ CONFIG END ------------------------------------------

#include <amxmodx>
#include <reapi>

enum any:CVARS
{
    GT_STATUS,
    GT_COLOR_HE,
    GT_COLOR_FB,
    GT_COLOR_SG,
    GT_TEAM_COLOR
}
new g_Cvar[CVARS];
new g_iSpriteLine, g_iSpriteArrow;

public plugin_precache()
{
    g_iSpriteArrow = precache_model("sprites/laserbeam.spr");
    //g_iSpriteLine  = precache_model("sprites/smoke.spr");
}

public plugin_init()
{
    register_plugin("[reapi] Grenade Trail", "1.3", "maFFyoZZyk");

    RegisterHookChain(RG_ThrowFlashbang, "ThrowGrenade_FB_Post", .post = true);
    RegisterHookChain(RG_ThrowHeGrenade, "ThrowGrenade_HE_Post", .post = true);
    RegisterHookChain(RG_ThrowSmokeGrenade, "ThrowGrenade_SG_Post", .post = true);

    RegisterCvars();
#if defined CREATE_CONFIG
    AutoExecConfig(true, "grenade_trail");
#endif
}

public ThrowGrenade_HE_Post(const pPlayer, Float:vecStart[3], Float:vecVelocity[3], Float:time)
{
    new pEntity = GetHookChainReturn(ATYPE_INTEGER);
    // set_entvar(pEntity, var_iuser1);
    func_ThrowGrenade_Post(pPlayer, pEntity);
}

public ThrowGrenade_FB_Post(const pPlayer, Float:vecStart[3], Float:vecVelocity[3], Float:time)
{
    new pEntity = GetHookChainReturn(ATYPE_INTEGER);
    // set_entvar(pEntity, var_iuser1);
    func_ThrowGrenade_Post(pPlayer, pEntity);
}

public ThrowGrenade_SG_Post(const pPlayer, Float:vecStart[3], Float:vecVelocity[3], Float:time)
{
    new pEntity = GetHookChainReturn(ATYPE_INTEGER);
    // set_entvar(pEntity, var_iuser1);
    func_ThrowGrenade_Post(pPlayer, pEntity);
}

func_ThrowGrenade_Post(pPlayer, pEntity)
{
    // new pPlayer = get_entvar(pEntity, var_iuser1);
    
    if (!is_entity(pEntity) || !is_user_connected(pPlayer))
        return HC_CONTINUE;   
    
    // if(!is_user_connected(pPlayer)) return HC_CONTINUE;
    new iTemp;
    switch( WeaponIdType:GetGrenadeType(pEntity))
    {
        case WEAPON_FLASHBANG:    iTemp = g_Cvar[GT_COLOR_FB];
        case WEAPON_HEGRENADE:    iTemp = g_Cvar[GT_COLOR_HE];
        case WEAPON_SMOKEGRENADE:    iTemp = g_Cvar[GT_COLOR_SG];
        default: return HC_CONTINUE;
    }
    
    new iRed = iTemp/1000000;
    iTemp %= 1000000;
    new iGreen = iTemp/1000;
    new iBlue = iTemp%1000;
    
    iTemp = clamp(g_Cvar[GT_TEAM_COLOR], 0, 1);
    switch( clamp(g_Cvar[GT_STATUS], 0, 3) )
    {
        case 1:
        {
            new CsTeams:iOwnerTeam = get_member(pPlayer, m_iTeam);
            
            for( new iPlayer=1; iPlayer<=MaxClients; iPlayer++ )
            {
                if( is_user_connected(iPlayer) )
                {
                    if( get_member(iPlayer, m_iTeam) == iOwnerTeam )
                    {
                        new Float: fColor[3]; 
    
                        fColor[0] = float(iRed);
                        fColor[1] = float(iGreen);
                        fColor[2] = float(iBlue);
                        set_entvar(pEntity, var_rendermode, kRenderGlow);
                        set_entvar(pEntity, var_renderamt, 1.0);
                        set_entvar(pEntity, var_rendercolor, fColor);
                        set_entvar(pEntity, var_renderfx, kRenderFxGlowShell);
                        message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                        write_byte(TE_BEAMFOLLOW);
                        write_short(pEntity);
                        write_short(g_iSpriteArrow);
                        write_byte(15);
                        write_byte(7);
                        write_byte(iRed);
                        write_byte(iGreen);
                        write_byte(iBlue);
                        write_byte(191);                       
                        message_end();
                        
                        if( iTemp )
                        {
                            message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                            write_byte(TE_BEAMFOLLOW);
                            write_short(pEntity);
                            write_short(g_iSpriteLine);
                            write_byte(15);
                            write_byte(1);
                            switch( iOwnerTeam )
                            {
                                case TEAM_TERRORIST:
                                {
                                    write_byte(255);
                                    write_byte(0);
                                    write_byte(0);       
                                }
                                case TEAM_CT:
                                {
                                    write_byte(0);
                                    write_byte(0);
                                    write_byte(255);
                                }
                                default:
                                {
                                    write_byte(127);
                                    write_byte(127);
                                    write_byte(127);
                                }
                            }
                            write_byte(191);
                            message_end();
                        }
                    }
                }
            }
        }
        case 2:
        {
            new CsTeams:iOwnerTeam = get_member(pPlayer, m_iTeam);
            
            for( new iPlayer=1; iPlayer<=MaxClients; iPlayer++ )
            {
                if(is_user_connected(iPlayer))
                {
                    if( is_user_alive(iPlayer) || get_member(iPlayer, m_iTeam) == iOwnerTeam )
                    {
                        message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                        write_byte(TE_BEAMFOLLOW);
                        write_short(pEntity);
                        write_short(g_iSpriteArrow);
                        write_byte(15);
                        write_byte(7);
                        write_byte(iRed);
                        write_byte(iGreen);
                        write_byte(iBlue);
                        write_byte(191);
                        message_end();
                        
                        if( iTemp )
                        {
                            message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                            write_byte(TE_BEAMFOLLOW);
                            write_short(pEntity);
                            write_short(g_iSpriteLine);
                            write_byte(15);
                            write_byte(1);
                            switch( iOwnerTeam )
                            {
                                case TEAM_TERRORIST:
                                {
                                    write_byte(255);
                                    write_byte(0);
                                    write_byte(0);
                                }
                                case TEAM_CT:
                                {
                                    write_byte(0);
                                    write_byte(0);
                                    write_byte(255);
                                }
                                default:
                                {
                                    write_byte(127);
                                    write_byte(127);
                                    write_byte(127);
                                }
                            }
                            write_byte(191);                           
                            message_end();
                        }
                    }
                }
            }
        }
        case 3:
        {
            message_begin(MSG_TYPE_ALL, SVC_TEMPENTITY);
            write_byte(TE_BEAMFOLLOW);
            write_short(pEntity);
            write_short(g_iSpriteArrow);
            write_byte(15);
            write_byte(7);
            write_byte(iRed);
            write_byte(iGreen);
            write_byte(iBlue);
            write_byte(191);
            message_end();
            
            if( iTemp )
            {
                message_begin(MSG_TYPE_ALL, SVC_TEMPENTITY);
                write_byte(TE_BEAMFOLLOW);
                write_short(pEntity);
                write_short(g_iSpriteLine);
                write_byte(15);
                write_byte(1);
                switch( get_member(pPlayer, m_iTeam) )
                {
                    case TEAM_TERRORIST:
                    {
                        write_byte(255);
                        write_byte(0);
                        write_byte(0);
                    }
                    case TEAM_CT:
                    {
                        write_byte(0);
                        write_byte(0);
                        write_byte(255);
                    }
                    default:
                    {
                        write_byte(127);
                        write_byte(127);
                        write_byte(127);
                    }
                }
                write_byte(191);       
                message_end();
            }
        }
    }
    return HC_CONTINUE;
}

RegisterCvars()
{
    bind_pcvar_num(
        create_cvar(
            .name = "amx_grentrail_status",
            .string = "3",
            .flags = FCVAR_SERVER,
            .description = fmt("Кто может видеть Ñлед? 3 - вÑе, 2 - команда и мертвые, 1 - только команда."),
            .has_min = true,
            .min_val = 0.0
        ), g_Cvar[GT_STATUS]
    );
    bind_pcvar_num(
        create_cvar(
            .name = "amx_grentrail_color_fb",
            .string = "000255255",
            .flags = FCVAR_SERVER,
            .description = fmt("Цвет Ñледа Ñлеповой [rrrgggbbb]. 000255255 - краÑный 0; 255 зеленый; 255 Ñиний."),
            .has_min = true,
            .min_val = 0.0
        ), g_Cvar[GT_COLOR_FB]
    );
    bind_pcvar_num(
        create_cvar(
            .name = "amx_grentrail_color_he",
            .string = "255063000",
            .flags = FCVAR_SERVER,
            .description = fmt("Цвет Ñледа оÑколочной [rrrgggbbb]. 255063000 - 255 краÑный; 63 зеленый; 0 Ñиний."),
            .has_min = true,
            .min_val = 0.0
        ), g_Cvar[GT_COLOR_HE]
    );
    bind_pcvar_num(
        create_cvar(
            .name = "amx_grentrail_color_sg",
            .string = "031255127",
            .flags = FCVAR_SERVER,
            .description = fmt("Цвет Ñледа дымовой [ррргггббб]. 031255127 - 31 краÑный; 255 зеленый; 127 Ñиний."),
            .has_min = true,
            .min_val = 0.0
        ), g_Cvar[GT_COLOR_SG]
    );
    bind_pcvar_num(
        create_cvar(
            .name = "amx_grentrail_team_color",
            .string = "1",
            .flags = FCVAR_SERVER,
            .description = fmt("Ð´Ð¾Ð¿Ð¾Ð»Ð½Ð¸Ñ‚ÐµÐ»ÑŒÐ½Ð°Ñ Ð»Ð¸Ð½Ð¸Ñ Ñ Ñ†Ð²ÐµÑ‚Ð¾Ð¼ команды. 1 - включено. 0 - отключен."),
            .has_min = true,
            .min_val = 0.0
        ), g_Cvar[GT_TEAM_COLOR]
    );
}
 
Сообщения
594
Реакции
350
Предупреждения
1
Помог
9 раз(а)
brdemirhan, Вам дали информацию, что нужно сделать. Если у вас нет понимания, то следует обратиться в раздел заказов.
 
Сообщения
68
Реакции
0
brdemirhan, Вам дали информацию, что нужно сделать. Если у вас нет понимания, то следует обратиться в раздел заказов.
:D ???????????
Я до сих пор понятия не имею, что делать. Никто не поделился своим мнением по этому поводу, или я не понял, что было сказано, потому что перевод может быть неверным.

Что бы ты ни понял, скажи мне еще раз, что мне делать.
 
Сообщения
673
Реакции
242
Помог
11 раз(а)
не путайте спрайт с энтити, c энтити надо задействовать фулл пак

Код:
// ----------------------------------------- CONFIG START -----------------------------------------

// If you are having problems, that not everyone who should see the trail is seeing them, that can
// be due to message type and ping. Using "MSG_ONE_UNRELIABLE" and "MSG_BROADCAST" is better for server
// stability, however using "MSG_ONE" and "MSG_ALL" garanties that client will recieve the update.
#define MSG_TYPE_ALONE MSG_ONE // default: (uncommented)
//#define MSG_TYPE_ALONE MSG_ONE_UNRELIABLE // default: (commented)
#define MSG_TYPE_ALL MSG_ALL // default: (uncommented)
//#define MSG_TYPE_ALL MSG_BROADCAST // default: (commented)


#define CREATE_CONFIG  // default: (uncommented)
// ------------------------------------------ CONFIG END ------------------------------------------

#include <amxmodx>
#include <reapi>
#include <fakemeta>

new g_iUserTeam[MAX_PLAYERS + 1] = { 'U', ... }
#define IsPlayer(%0) (1 <= %0 <= MaxClients)
new g_pEntity[MAX_PLAYERS + 1];


enum any:CVARS
{
    GT_STATUS,
    GT_COLOR_HE,
    GT_COLOR_FB,
    GT_COLOR_SG,
    GT_TEAM_COLOR
}
new g_Cvar[CVARS];
new g_iSpriteLine, g_iSpriteArrow;

public plugin_precache()
{
    g_iSpriteArrow = precache_model("sprites/laserbeam.spr");
    //g_iSpriteLine  = precache_model("sprites/smoke.spr");
}

public plugin_init()
{
    register_plugin("[reapi] Grenade Trail", "1.3", "maFFyoZZyk");

    RegisterHookChain(RG_ThrowFlashbang, "ThrowGrenade_FB_Post", .post = true);
    RegisterHookChain(RG_ThrowHeGrenade, "ThrowGrenade_HE_Post", .post = true);
    RegisterHookChain(RG_ThrowSmokeGrenade, "ThrowGrenade_SG_Post", .post = true);
  
    register_forward(FM_AddToFullPack,                     "OnAddToFullPack_Post", true);
    register_event("TeamInfo", "event_TeamInfo", "a");
  
    RegisterCvars();
#if defined CREATE_CONFIG
    AutoExecConfig(true, "grenade_trail");
#endif
}

public ThrowGrenade_HE_Post(const pPlayer, Float:vecStart[3], Float:vecVelocity[3], Float:time)
{
    new pEntity = GetHookChainReturn(ATYPE_INTEGER);
    // set_entvar(pEntity, var_iuser1);
    func_ThrowGrenade_Post(pPlayer, pEntity);
}

public ThrowGrenade_FB_Post(const pPlayer, Float:vecStart[3], Float:vecVelocity[3], Float:time)
{
    new pEntity = GetHookChainReturn(ATYPE_INTEGER);
    // set_entvar(pEntity, var_iuser1);
    func_ThrowGrenade_Post(pPlayer, pEntity);
}

public ThrowGrenade_SG_Post(const pPlayer, Float:vecStart[3], Float:vecVelocity[3], Float:time)
{
    new pEntity = GetHookChainReturn(ATYPE_INTEGER);
    // set_entvar(pEntity, var_iuser1);
    func_ThrowGrenade_Post(pPlayer, pEntity);
}

func_ThrowGrenade_Post(pPlayer, pEntity)
{
    // new pPlayer = get_entvar(pEntity, var_iuser1);
  
    if (!is_entity(pEntity) || !is_user_connected(pPlayer))
    return HC_CONTINUE; 
  
    // if(!is_user_connected(pPlayer)) return HC_CONTINUE;
  
    set_entvar(pEntity, var_owner, pPlayer);
    g_pEntity[pPlayer] = pEntity;
  
    new iTemp;
    switch( WeaponIdType:GetGrenadeType(pEntity))
    {
    case WEAPON_FLASHBANG:    iTemp = g_Cvar[GT_COLOR_FB];
    case WEAPON_HEGRENADE:    iTemp = g_Cvar[GT_COLOR_HE];
    case WEAPON_SMOKEGRENADE:    iTemp = g_Cvar[GT_COLOR_SG];
    default: return HC_CONTINUE;
    }
  
  
  
    new iRed = iTemp/1000000;
    iTemp %= 1000000;
    new iGreen = iTemp/1000;
    new iBlue = iTemp%1000;
  

  
    iTemp = clamp(g_Cvar[GT_TEAM_COLOR], 0, 1);
    switch( clamp(g_Cvar[GT_STATUS], 0, 3) )
    {
    case 1:
        {
            new CsTeams:iOwnerTeam = get_member(pPlayer, m_iTeam);
          
            for( new iPlayer=1; iPlayer<=MaxClients; iPlayer++ )
            {
                if( is_user_connected(iPlayer) )
                {
                    if( get_member(iPlayer, m_iTeam) == iOwnerTeam )
                    {
                      
                        message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                        write_byte(TE_BEAMFOLLOW);
                        write_short(pEntity);
                        write_short(g_iSpriteArrow);
                        write_byte(15);
                        write_byte(7);
                        write_byte(iRed);
                        write_byte(iGreen);
                        write_byte(iBlue);
                        write_byte(191);                     
                        message_end();
                      
                        if( iTemp )
                        {
                            message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                            write_byte(TE_BEAMFOLLOW);
                            write_short(pEntity);
                            write_short(g_iSpriteLine);
                            write_byte(15);
                            write_byte(1);
                            switch( iOwnerTeam )
                            {
                            case TEAM_TERRORIST:
                                {
                                    write_byte(255);
                                    write_byte(0);
                                    write_byte(0);     
                                }
                            case TEAM_CT:
                                {
                                    write_byte(0);
                                    write_byte(0);
                                    write_byte(255);
                                }
                            default:
                                {
                                    write_byte(127);
                                    write_byte(127);
                                    write_byte(127);
                                }
                            }
                            write_byte(191);
                            message_end();
                        }
                    }
                }
            }
        }
    case 2:
        {
            new CsTeams:iOwnerTeam = get_member(pPlayer, m_iTeam);
          
            for( new iPlayer=1; iPlayer<=MaxClients; iPlayer++ )
            {
                if(is_user_connected(iPlayer))
                {
                    if( is_user_alive(iPlayer) || get_member(iPlayer, m_iTeam) == iOwnerTeam )
                    {
                        message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                        write_byte(TE_BEAMFOLLOW);
                        write_short(pEntity);
                        write_short(g_iSpriteArrow);
                        write_byte(15);
                        write_byte(7);
                        write_byte(iRed);
                        write_byte(iGreen);
                        write_byte(iBlue);
                        write_byte(191);
                        message_end();
                      
                        if( iTemp )
                        {
                            message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                            write_byte(TE_BEAMFOLLOW);
                            write_short(pEntity);
                            write_short(g_iSpriteLine);
                            write_byte(15);
                            write_byte(1);
                            switch( iOwnerTeam )
                            {
                            case TEAM_TERRORIST:
                                {
                                    write_byte(255);
                                    write_byte(0);
                                    write_byte(0);
                                }
                            case TEAM_CT:
                                {
                                    write_byte(0);
                                    write_byte(0);
                                    write_byte(255);
                                }
                            default:
                                {
                                    write_byte(127);
                                    write_byte(127);
                                    write_byte(127);
                                }
                            }
                            write_byte(191);                         
                            message_end();
                        }
                    }
                }
            }
        }
    case 3:
        {
            message_begin(MSG_TYPE_ALL, SVC_TEMPENTITY);
            write_byte(TE_BEAMFOLLOW);
            write_short(pEntity);
            write_short(g_iSpriteArrow);
            write_byte(15);
            write_byte(7);
            write_byte(iRed);
            write_byte(iGreen);
            write_byte(iBlue);
            write_byte(191);
            message_end();
          
            if( iTemp )
            {
                message_begin(MSG_TYPE_ALL, SVC_TEMPENTITY);
                write_byte(TE_BEAMFOLLOW);
                write_short(pEntity);
                write_short(g_iSpriteLine);
                write_byte(15);
                write_byte(1);
                switch( get_member(pPlayer, m_iTeam) )
                {
                case TEAM_TERRORIST:
                    {
                        write_byte(255);
                        write_byte(0);
                        write_byte(0);
                    }
                case TEAM_CT:
                    {
                        write_byte(0);
                        write_byte(0);
                        write_byte(255);
                    }
                default:
                    {
                        write_byte(127);
                        write_byte(127);
                        write_byte(127);
                    }
                }
                write_byte(191);     
                message_end();
            }
        }
    }
    return HC_CONTINUE;
}

RegisterCvars()
{
    bind_pcvar_num(
    create_cvar(
    .name = "amx_grentrail_status",
    .string = "3",
    .flags = FCVAR_SERVER,
    .description = fmt("Кто может видеть Ñлед? 3 - вÑе, 2 - команда и мертвые, 1 - только команда."),
    .has_min = true,
    .min_val = 0.0
    ), g_Cvar[GT_STATUS]
    );
    bind_pcvar_num(
    create_cvar(
    .name = "amx_grentrail_color_fb",
    .string = "000255255",
    .flags = FCVAR_SERVER,
    .description = fmt("Цвет Ñледа Ñлеповой [rrrgggbbb]. 000255255 - краÑный 0; 255 зеленый; 255 Ñиний."),
    .has_min = true,
    .min_val = 0.0
    ), g_Cvar[GT_COLOR_FB]
    );
    bind_pcvar_num(
    create_cvar(
    .name = "amx_grentrail_color_he",
    .string = "255063000",
    .flags = FCVAR_SERVER,
    .description = fmt("Цвет Ñледа оÑколочной [rrrgggbbb]. 255063000 - 255 краÑный; 63 зеленый; 0 Ñиний."),
    .has_min = true,
    .min_val = 0.0
    ), g_Cvar[GT_COLOR_HE]
    );
    bind_pcvar_num(
    create_cvar(
    .name = "amx_grentrail_color_sg",
    .string = "031255127",
    .flags = FCVAR_SERVER,
    .description = fmt("Цвет Ñледа дымовой [ррргггббб]. 031255127 - 31 краÑный; 255 зеленый; 127 Ñиний."),
    .has_min = true,
    .min_val = 0.0
    ), g_Cvar[GT_COLOR_SG]
    );
    bind_pcvar_num(
    create_cvar(
    .name = "amx_grentrail_team_color",
    .string = "1",
    .flags = FCVAR_SERVER,
    .description = fmt("Ð´Ð¾Ð¿Ð¾Ð»Ð½Ð¸Ñ‚ÐµÐ»ÑŒÐ½Ð°Ñ Ð»Ð¸Ð½Ð¸Ñ Ñ Ñ†Ð²ÐµÑ‚Ð¾Ð¼ команды. 1 - включено. 0 - отключен."),
    .has_min = true,
    .min_val = 0.0
    ), g_Cvar[GT_TEAM_COLOR]
    );
}


public OnAddToFullPack_Post(es, e, ent, host, flags, player, pSet)
{
    if(player || !pev_valid(ent)) {
        return FMRES_IGNORED
    }

    new iTemp;
    switch( WeaponIdType:GetGrenadeType(ent))
    {
    case WEAPON_FLASHBANG:    iTemp = g_Cvar[GT_COLOR_FB];
    case WEAPON_HEGRENADE:    iTemp = g_Cvar[GT_COLOR_HE];
    case WEAPON_SMOKEGRENADE:    iTemp = g_Cvar[GT_COLOR_SG];
    default: return FMRES_IGNORED;
    }
  
    new pOwner = get_entvar(ent, var_owner)
  
    if(g_pEntity[pOwner] != ent || g_iUserTeam[pOwner] != g_iUserTeam[host])
    {
        return FMRES_IGNORED
    }

    new iRed = iTemp/1000000;
    iTemp %= 1000000;
    new iGreen = iTemp/1000;
    new iBlue = iTemp%1000;

    set_es(es, ES_RenderMode, kRenderGlow)
    set_es(es, ES_RenderAmt, 100.0);
    set_es(es, ES_RenderColor, iRed,iGreen, iBlue);
    set_es(es, ES_RenderFx, kRenderFxGlowShell);
  
    return FMRES_IGNORED
}

public event_TeamInfo()
{
    enum
    {
        arg_player = 1,
        arg_team
    }

    new szNewTeam[2];
    read_data(arg_team, szNewTeam, charsmax(szNewTeam))

    g_iUserTeam[ read_data(arg_player) ] = szNewTeam[0]
  
}


Код:
public OnAddToFullPack_Post(es, e, ent, host, flags, player, pSet)
{
    if(player || !pev_valid(ent)) {
        return FMRES_IGNORED
    }

    new iTemp;
    switch( WeaponIdType:GetGrenadeType(ent))
    {
    case WEAPON_FLASHBANG:    iTemp = g_Cvar[GT_COLOR_FB];
    case WEAPON_HEGRENADE:    iTemp = g_Cvar[GT_COLOR_HE];
    case WEAPON_SMOKEGRENADE:    iTemp = g_Cvar[GT_COLOR_SG];
    default: return FMRES_IGNORED;
    }
  
    new pOwner = get_entvar(ent, var_owner)
  
    if(g_pEntity[pOwner] != ent || g_iUserTeam[pOwner] != g_iUserTeam[host])
    {
        return FMRES_IGNORED
    }

    new iRed = iTemp/1000000;
    iTemp %= 1000000;
    new iGreen = iTemp/1000;
    new iBlue = iTemp%1000;

    set_es(es, ES_RenderMode, kRenderGlow)
    set_es(es, ES_RenderAmt, 100.0);
    set_es(es, ES_RenderColor, iRed,iGreen, iBlue);
    set_es(es, ES_RenderFx, kRenderFxGlowShell);
  
    return FMRES_IGNORED
}

public event_TeamInfo()
{
    enum
    {
        arg_player = 1,
        arg_team
    }

    new szNewTeam[2];
    read_data(arg_team, szNewTeam, charsmax(szNewTeam))

    g_iUserTeam[ read_data(arg_player) ] = szNewTeam[0]
  
}
 
Сообщения
68
Реакции
0
не путайте спрайт с энтити, c энтити надо задействовать фулл пак

Код:
// ----------------------------------------- CONFIG START -----------------------------------------

// If you are having problems, that not everyone who should see the trail is seeing them, that can
// be due to message type and ping. Using "MSG_ONE_UNRELIABLE" and "MSG_BROADCAST" is better for server
// stability, however using "MSG_ONE" and "MSG_ALL" garanties that client will recieve the update.
#define MSG_TYPE_ALONE MSG_ONE // default: (uncommented)
//#define MSG_TYPE_ALONE MSG_ONE_UNRELIABLE // default: (commented)
#define MSG_TYPE_ALL MSG_ALL // default: (uncommented)
//#define MSG_TYPE_ALL MSG_BROADCAST // default: (commented)


#define CREATE_CONFIG  // default: (uncommented)
// ------------------------------------------ CONFIG END ------------------------------------------

#include <amxmodx>
#include <reapi>
#include <fakemeta>

new g_iUserTeam[MAX_PLAYERS + 1] = { 'U', ... }
#define IsPlayer(%0) (1 <= %0 <= MaxClients)
new g_pEntity[MAX_PLAYERS + 1];


enum any:CVARS
{
    GT_STATUS,
    GT_COLOR_HE,
    GT_COLOR_FB,
    GT_COLOR_SG,
    GT_TEAM_COLOR
}
new g_Cvar[CVARS];
new g_iSpriteLine, g_iSpriteArrow;

public plugin_precache()
{
    g_iSpriteArrow = precache_model("sprites/laserbeam.spr");
    //g_iSpriteLine  = precache_model("sprites/smoke.spr");
}

public plugin_init()
{
    register_plugin("[reapi] Grenade Trail", "1.3", "maFFyoZZyk");

    RegisterHookChain(RG_ThrowFlashbang, "ThrowGrenade_FB_Post", .post = true);
    RegisterHookChain(RG_ThrowHeGrenade, "ThrowGrenade_HE_Post", .post = true);
    RegisterHookChain(RG_ThrowSmokeGrenade, "ThrowGrenade_SG_Post", .post = true);
 
    register_forward(FM_AddToFullPack,                     "OnAddToFullPack_Post", true);
    register_event("TeamInfo", "event_TeamInfo", "a");
 
    RegisterCvars();
#if defined CREATE_CONFIG
    AutoExecConfig(true, "grenade_trail");
#endif
}

public ThrowGrenade_HE_Post(const pPlayer, Float:vecStart[3], Float:vecVelocity[3], Float:time)
{
    new pEntity = GetHookChainReturn(ATYPE_INTEGER);
    // set_entvar(pEntity, var_iuser1);
    func_ThrowGrenade_Post(pPlayer, pEntity);
}

public ThrowGrenade_FB_Post(const pPlayer, Float:vecStart[3], Float:vecVelocity[3], Float:time)
{
    new pEntity = GetHookChainReturn(ATYPE_INTEGER);
    // set_entvar(pEntity, var_iuser1);
    func_ThrowGrenade_Post(pPlayer, pEntity);
}

public ThrowGrenade_SG_Post(const pPlayer, Float:vecStart[3], Float:vecVelocity[3], Float:time)
{
    new pEntity = GetHookChainReturn(ATYPE_INTEGER);
    // set_entvar(pEntity, var_iuser1);
    func_ThrowGrenade_Post(pPlayer, pEntity);
}

func_ThrowGrenade_Post(pPlayer, pEntity)
{
    // new pPlayer = get_entvar(pEntity, var_iuser1);
 
    if (!is_entity(pEntity) || !is_user_connected(pPlayer))
    return HC_CONTINUE;
 
    // if(!is_user_connected(pPlayer)) return HC_CONTINUE;
 
    set_entvar(pEntity, var_owner, pPlayer);
    g_pEntity[pPlayer] = pEntity;
 
    new iTemp;
    switch( WeaponIdType:GetGrenadeType(pEntity))
    {
    case WEAPON_FLASHBANG:    iTemp = g_Cvar[GT_COLOR_FB];
    case WEAPON_HEGRENADE:    iTemp = g_Cvar[GT_COLOR_HE];
    case WEAPON_SMOKEGRENADE:    iTemp = g_Cvar[GT_COLOR_SG];
    default: return HC_CONTINUE;
    }
 
 
 
    new iRed = iTemp/1000000;
    iTemp %= 1000000;
    new iGreen = iTemp/1000;
    new iBlue = iTemp%1000;
 

 
    iTemp = clamp(g_Cvar[GT_TEAM_COLOR], 0, 1);
    switch( clamp(g_Cvar[GT_STATUS], 0, 3) )
    {
    case 1:
        {
            new CsTeams:iOwnerTeam = get_member(pPlayer, m_iTeam);
         
            for( new iPlayer=1; iPlayer<=MaxClients; iPlayer++ )
            {
                if( is_user_connected(iPlayer) )
                {
                    if( get_member(iPlayer, m_iTeam) == iOwnerTeam )
                    {
                     
                        message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                        write_byte(TE_BEAMFOLLOW);
                        write_short(pEntity);
                        write_short(g_iSpriteArrow);
                        write_byte(15);
                        write_byte(7);
                        write_byte(iRed);
                        write_byte(iGreen);
                        write_byte(iBlue);
                        write_byte(191);                    
                        message_end();
                     
                        if( iTemp )
                        {
                            message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                            write_byte(TE_BEAMFOLLOW);
                            write_short(pEntity);
                            write_short(g_iSpriteLine);
                            write_byte(15);
                            write_byte(1);
                            switch( iOwnerTeam )
                            {
                            case TEAM_TERRORIST:
                                {
                                    write_byte(255);
                                    write_byte(0);
                                    write_byte(0);    
                                }
                            case TEAM_CT:
                                {
                                    write_byte(0);
                                    write_byte(0);
                                    write_byte(255);
                                }
                            default:
                                {
                                    write_byte(127);
                                    write_byte(127);
                                    write_byte(127);
                                }
                            }
                            write_byte(191);
                            message_end();
                        }
                    }
                }
            }
        }
    case 2:
        {
            new CsTeams:iOwnerTeam = get_member(pPlayer, m_iTeam);
         
            for( new iPlayer=1; iPlayer<=MaxClients; iPlayer++ )
            {
                if(is_user_connected(iPlayer))
                {
                    if( is_user_alive(iPlayer) || get_member(iPlayer, m_iTeam) == iOwnerTeam )
                    {
                        message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                        write_byte(TE_BEAMFOLLOW);
                        write_short(pEntity);
                        write_short(g_iSpriteArrow);
                        write_byte(15);
                        write_byte(7);
                        write_byte(iRed);
                        write_byte(iGreen);
                        write_byte(iBlue);
                        write_byte(191);
                        message_end();
                     
                        if( iTemp )
                        {
                            message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                            write_byte(TE_BEAMFOLLOW);
                            write_short(pEntity);
                            write_short(g_iSpriteLine);
                            write_byte(15);
                            write_byte(1);
                            switch( iOwnerTeam )
                            {
                            case TEAM_TERRORIST:
                                {
                                    write_byte(255);
                                    write_byte(0);
                                    write_byte(0);
                                }
                            case TEAM_CT:
                                {
                                    write_byte(0);
                                    write_byte(0);
                                    write_byte(255);
                                }
                            default:
                                {
                                    write_byte(127);
                                    write_byte(127);
                                    write_byte(127);
                                }
                            }
                            write_byte(191);                        
                            message_end();
                        }
                    }
                }
            }
        }
    case 3:
        {
            message_begin(MSG_TYPE_ALL, SVC_TEMPENTITY);
            write_byte(TE_BEAMFOLLOW);
            write_short(pEntity);
            write_short(g_iSpriteArrow);
            write_byte(15);
            write_byte(7);
            write_byte(iRed);
            write_byte(iGreen);
            write_byte(iBlue);
            write_byte(191);
            message_end();
         
            if( iTemp )
            {
                message_begin(MSG_TYPE_ALL, SVC_TEMPENTITY);
                write_byte(TE_BEAMFOLLOW);
                write_short(pEntity);
                write_short(g_iSpriteLine);
                write_byte(15);
                write_byte(1);
                switch( get_member(pPlayer, m_iTeam) )
                {
                case TEAM_TERRORIST:
                    {
                        write_byte(255);
                        write_byte(0);
                        write_byte(0);
                    }
                case TEAM_CT:
                    {
                        write_byte(0);
                        write_byte(0);
                        write_byte(255);
                    }
                default:
                    {
                        write_byte(127);
                        write_byte(127);
                        write_byte(127);
                    }
                }
                write_byte(191);    
                message_end();
            }
        }
    }
    return HC_CONTINUE;
}

RegisterCvars()
{
    bind_pcvar_num(
    create_cvar(
    .name = "amx_grentrail_status",
    .string = "3",
    .flags = FCVAR_SERVER,
    .description = fmt("Кто может видеть Ñлед? 3 - вÑе, 2 - команда и мертвые, 1 - только команда."),
    .has_min = true,
    .min_val = 0.0
    ), g_Cvar[GT_STATUS]
    );
    bind_pcvar_num(
    create_cvar(
    .name = "amx_grentrail_color_fb",
    .string = "000255255",
    .flags = FCVAR_SERVER,
    .description = fmt("Цвет Ñледа Ñлеповой [rrrgggbbb]. 000255255 - краÑный 0; 255 зеленый; 255 Ñиний."),
    .has_min = true,
    .min_val = 0.0
    ), g_Cvar[GT_COLOR_FB]
    );
    bind_pcvar_num(
    create_cvar(
    .name = "amx_grentrail_color_he",
    .string = "255063000",
    .flags = FCVAR_SERVER,
    .description = fmt("Цвет Ñледа оÑколочной [rrrgggbbb]. 255063000 - 255 краÑный; 63 зеленый; 0 Ñиний."),
    .has_min = true,
    .min_val = 0.0
    ), g_Cvar[GT_COLOR_HE]
    );
    bind_pcvar_num(
    create_cvar(
    .name = "amx_grentrail_color_sg",
    .string = "031255127",
    .flags = FCVAR_SERVER,
    .description = fmt("Цвет Ñледа дымовой [ррргггббб]. 031255127 - 31 краÑный; 255 зеленый; 127 Ñиний."),
    .has_min = true,
    .min_val = 0.0
    ), g_Cvar[GT_COLOR_SG]
    );
    bind_pcvar_num(
    create_cvar(
    .name = "amx_grentrail_team_color",
    .string = "1",
    .flags = FCVAR_SERVER,
    .description = fmt("Ð´Ð¾Ð¿Ð¾Ð»Ð½Ð¸Ñ‚ÐµÐ»ÑŒÐ½Ð°Ñ Ð»Ð¸Ð½Ð¸Ñ Ñ Ñ†Ð²ÐµÑ‚Ð¾Ð¼ команды. 1 - включено. 0 - отключен."),
    .has_min = true,
    .min_val = 0.0
    ), g_Cvar[GT_TEAM_COLOR]
    );
}


public OnAddToFullPack_Post(es, e, ent, host, flags, player, pSet)
{
    if(player || !pev_valid(ent)) {
        return FMRES_IGNORED
    }

    new iTemp;
    switch( WeaponIdType:GetGrenadeType(ent))
    {
    case WEAPON_FLASHBANG:    iTemp = g_Cvar[GT_COLOR_FB];
    case WEAPON_HEGRENADE:    iTemp = g_Cvar[GT_COLOR_HE];
    case WEAPON_SMOKEGRENADE:    iTemp = g_Cvar[GT_COLOR_SG];
    default: return FMRES_IGNORED;
    }
 
    new pOwner = get_entvar(ent, var_owner)
 
    if(g_pEntity[pOwner] != ent || g_iUserTeam[pOwner] != g_iUserTeam[host])
    {
        return FMRES_IGNORED
    }

    new iRed = iTemp/1000000;
    iTemp %= 1000000;
    new iGreen = iTemp/1000;
    new iBlue = iTemp%1000;

    set_es(es, ES_RenderMode, kRenderGlow)
    set_es(es, ES_RenderAmt, 100.0);
    set_es(es, ES_RenderColor, iRed,iGreen, iBlue);
    set_es(es, ES_RenderFx, kRenderFxGlowShell);
 
    return FMRES_IGNORED
}

public event_TeamInfo()
{
    enum
    {
        arg_player = 1,
        arg_team
    }

    new szNewTeam[2];
    read_data(arg_team, szNewTeam, charsmax(szNewTeam))

    g_iUserTeam[ read_data(arg_player) ] = szNewTeam[0]
 
}


Код:
public OnAddToFullPack_Post(es, e, ent, host, flags, player, pSet)
{
    if(player || !pev_valid(ent)) {
        return FMRES_IGNORED
    }

    new iTemp;
    switch( WeaponIdType:GetGrenadeType(ent))
    {
    case WEAPON_FLASHBANG:    iTemp = g_Cvar[GT_COLOR_FB];
    case WEAPON_HEGRENADE:    iTemp = g_Cvar[GT_COLOR_HE];
    case WEAPON_SMOKEGRENADE:    iTemp = g_Cvar[GT_COLOR_SG];
    default: return FMRES_IGNORED;
    }
 
    new pOwner = get_entvar(ent, var_owner)
 
    if(g_pEntity[pOwner] != ent || g_iUserTeam[pOwner] != g_iUserTeam[host])
    {
        return FMRES_IGNORED
    }

    new iRed = iTemp/1000000;
    iTemp %= 1000000;
    new iGreen = iTemp/1000;
    new iBlue = iTemp%1000;

    set_es(es, ES_RenderMode, kRenderGlow)
    set_es(es, ES_RenderAmt, 100.0);
    set_es(es, ES_RenderColor, iRed,iGreen, iBlue);
    set_es(es, ES_RenderFx, kRenderFxGlowShell);
 
    return FMRES_IGNORED
}

public event_TeamInfo()
{
    enum
    {
        arg_player = 1,
        arg_team
    }

    new szNewTeam[2];
    read_data(arg_team, szNewTeam, charsmax(szNewTeam))

    g_iUserTeam[ read_data(arg_player) ] = szNewTeam[0]
 
}
Мне не нужна была эта строка кода, но спасибо за дополнительную помощь. Все становится яснее, когда отвечаешь на объяснительном языке.
Вот чему я хотел научиться.
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу