Поиск Team Grenade Trail

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
95
Реакции
7
Предупреждения
5
Неверный раздел форума
Здравствуйте, я нашел этот плагин для цвета гранаты, и он хорошо работает. Могу ли я добавить цвета к Molotov и HealthNade?

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

// Если у вас есть проблемы с тем, что не все, кому нужно видеть путь, видят его, это может
// связано с типом сообщения и пингом. Использование «MSG_ONE_UNRELIABLE» и «MSG_BROADCAST» лучше для сервера
// стабильность, независимо от использования «MSG_ONE» и «MSG_ALL» гарантирует, что клиент получит обновление.
//#define MSG_TYPE_ALONE MSG_ONE // по умолчанию: (без комментариев)
#define MSG_TYPE_ALONE MSG_ONE_UNRELIABLE // по умолчанию: (закомментировано)
#define MSG_TYPE_ALL MSG_ALL // по умолчанию: (без комментариев)
//#define MSG_TYPE_ALL MSG_BROADCAST // по умолчанию: (закомментировано)

// ------------------------------------------ CONFIG END ------------------------------------------


#include <amxmodx>
#include <cstrike>
#include <csx>

#define PLUGIN_NAME    "Team Grenade Trail"
#define PLUGIN_VERSION    "1.2"
#define PLUGIN_AUTHOR    "Numb"

#define SetPlayerBit(%1,%2)    ( %1 |=  ( 1 << ( %2 & 31 ) ) )
#define ClearPlayerBit(%1,%2)  ( %1 &= ~( 1 << ( %2 & 31 ) ) )
#define CheckPlayerBit(%1,%2)  ( %1 &   ( 1 << ( %2 & 31 ) ) )

new g_iCvar_ColorFlash;
new g_iCvar_ColorHe;
new g_iCvar_ColorSmoke;
new g_iCvar_TrailStatus;
new g_iCvar_TeamColor;

new g_iSpriteLine;
new g_iSpriteArrow;

new g_iConnectedUsers;
new g_iDeadUsers;
new g_iMaxPlayers;

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

public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
   
    g_iCvar_TrailStatus = register_cvar("amx_grentrail_status", "1");
   
    g_iCvar_ColorFlash  = register_cvar("amx_grentrail_color_fb", "255255255");
    g_iCvar_ColorHe     = register_cvar("amx_grentrail_color_he", "150000000");
    g_iCvar_ColorSmoke  = register_cvar("amx_grentrail_color_sg", "000080000");
   
    g_iCvar_TeamColor   = register_cvar("amx_grentrail_team_color", "0");
   
    register_event("ResetHUD", "Event_ResetHUD", "be");
    register_event("Health",   "Event_Health",   "bd");
   
    g_iMaxPlayers = clamp(get_maxplayers(), 1, 32);
}

public client_connect(iPlrId)
{
    ClearPlayerBit(g_iConnectedUsers, iPlrId);
    ClearPlayerBit(g_iDeadUsers, iPlrId);
}

public client_putinserver(iPlrId)
{
    if( !is_user_bot(iPlrId) )
    {
        SetPlayerBit(g_iConnectedUsers, iPlrId);
        if( is_user_alive(iPlrId) )
            ClearPlayerBit(g_iDeadUsers, iPlrId);
        else
            SetPlayerBit(g_iDeadUsers, iPlrId);
    }
}

public client_disconnected(iPlrId)
{
    ClearPlayerBit(g_iConnectedUsers, iPlrId);
    ClearPlayerBit(g_iDeadUsers, iPlrId);
}

public Event_ResetHUD(iPlrId)
{
    if( CheckPlayerBit(g_iConnectedUsers, iPlrId) )
    {
        if( is_user_alive(iPlrId) )
            ClearPlayerBit(g_iDeadUsers, iPlrId);
        else
            SetPlayerBit(g_iDeadUsers, iPlrId);
    }
}

public Event_Health(iPlrId)
{
    if( CheckPlayerBit(g_iConnectedUsers, iPlrId) )
    {
        if( is_user_alive(iPlrId) )
            ClearPlayerBit(g_iDeadUsers, iPlrId);
        else
            SetPlayerBit(g_iDeadUsers, iPlrId);
    }
}

public plugin_unpause()
{
    g_iConnectedUsers = 0;
    g_iDeadUsers = 0;
   
    for( new iPlrId=1; iPlrId<=g_iMaxPlayers; iPlrId++ )
    {
        if( is_user_connected(iPlrId) )
        {
            if( !is_user_bot(iPlrId) )
            {
                SetPlayerBit(g_iConnectedUsers, iPlrId);
                if( !is_user_alive(iPlrId) )
                    SetPlayerBit(g_iDeadUsers, iPlrId);
            }
        }
    }
}

public grenade_throw(iPlrId, iGrenId, iWeaponType)
{
    new iTemp;
    switch( iWeaponType )
    {
        case CSW_FLASHBANG:    iTemp = get_pcvar_num(g_iCvar_ColorFlash);
        case CSW_HEGRENADE:    iTemp = get_pcvar_num(g_iCvar_ColorHe);
        case CSW_SMOKEGRENADE: iTemp = get_pcvar_num(g_iCvar_ColorSmoke);
        default: return;
    }
   
    if ( !iTemp )
        return
   
    new iRed = iTemp/1000000;
    iTemp %= 1000000;
    new iGreen = iTemp/1000;
    new iBlue = iTemp%1000;
   
    iTemp = clamp(get_pcvar_num(g_iCvar_TeamColor), 0, 1);
   
    switch( clamp(get_pcvar_num(g_iCvar_TrailStatus), 0, 3) )
    {
        case 1:
        {
            new CsTeams:iOwnerTeam = cs_get_user_team(iPlrId);
           
            for( new iPlayer=1; iPlayer<=g_iMaxPlayers; iPlayer++ )
            {
                if( CheckPlayerBit(g_iConnectedUsers, iPlayer) )
                {
                    if( cs_get_user_team(iPlayer)==iOwnerTeam )
                    {
                        message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                        write_byte(TE_BEAMFOLLOW);
                        write_short(iGrenId);
                        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(iGrenId);
                            write_short(g_iSpriteLine);
                            write_byte(15);
                            write_byte(1);
                            switch( iOwnerTeam )
                            {
                                case CS_TEAM_T:
                                {
                                    write_byte(255);
                                    write_byte(0);
                                    write_byte(0);
                                }
                                case CS_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 = cs_get_user_team(iPlrId);
           
            for( new iPlayer=1; iPlayer<=g_iMaxPlayers; iPlayer++ )
            {
                if( CheckPlayerBit(g_iConnectedUsers, iPlayer) )
                {
                    if( CheckPlayerBit(g_iDeadUsers, iPlayer) || cs_get_user_team(iPlayer)==iOwnerTeam )
                    {
                        message_begin(MSG_TYPE_ALONE, SVC_TEMPENTITY, _, iPlayer);
                        write_byte(TE_BEAMFOLLOW);
                        write_short(iGrenId);
                        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(iGrenId);
                            write_short(g_iSpriteLine);
                            write_byte(15);
                            write_byte(1);
                            switch( iOwnerTeam )
                            {
                                case CS_TEAM_T:
                                {
                                    write_byte(255);
                                    write_byte(0);
                                    write_byte(0);
                                }
                                case CS_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(iGrenId);
            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(iGrenId);
                write_short(g_iSpriteLine);
                write_byte(15);
                write_byte(1);
                switch( cs_get_user_team(iPlrId) )
                {
                    case CS_TEAM_T:
                    {
                        write_byte(255);
                        write_byte(0);
                        write_byte(0);
                    }
                    case CS_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();
            }
        }
    }
}
 
Статус
В этой теме нельзя размещать новые ответы.

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

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