Colored Names & Teams (chat/scoreboard/kill feed)

Сообщения
78
Реакции
13
Доброго здравия всем пользователям данного форума. Вопрос по уже готовому плагину.
Есть такой плагин Colored Names & Teams

Код:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define PLUGIN "Colored Names & Teams"
#define VERSION "1.8"
#define AUTHOR "C.ix"

#define PFLAG_OBSERVER (1<<5)
#define m_afPhysicsFlags 194
#define MAX_TEAMNAME 32

new g_ColorNames;
new g_TeamAdmins;

new g_TeamNameBlue;
new g_TeamNameRed;
new g_TeamNameYellow;
new g_TeamNameGreen;
new g_TeamNameGray;

new g_ColorPlayer;
new g_ColorAdmin;
new g_ColorHLTV;
new g_ColorSpectator;

new g_MsgScoreInfo;
new g_MsgTeamInfo;
new g_MsgGameMode;
new g_MsgTeamNames;

#if AMXX_VERSION_NUM > 182
new g_bUpdateTeamNames;
new g_bUpdateColors;
#endif

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);

    if (!is_running("valve"))
    {
        log_amx("Plugin stopped: Unsupported mod detected (requires Half-Life 1)");
        pause("d");
    }

    g_MsgScoreInfo = get_user_msgid("ScoreInfo");
    g_MsgTeamInfo = get_user_msgid("TeamInfo");
    g_MsgGameMode = get_user_msgid("GameMode");
    g_MsgTeamNames = get_user_msgid("TeamNames");

    register_message(g_MsgScoreInfo, "fw_ScoreInfo_Msg");
    register_event("TeamInfo", "ev_TeamInfo", "a");

#if AMXX_VERSION_NUM > 182
    g_ColorNames = create_cvar("cn_enable", "1", FCVAR_NONE, "Enable/Disable the plugin", true, 0.0, true, 1.0);
    g_TeamAdmins = create_cvar("cn_team_admins", "1", FCVAR_NONE, "Separate admin team", true, 0.0, true, 1.0);

    g_TeamNameBlue = create_cvar("cn_teamname_blue", "Players", FCVAR_NONE, "Set the name for the players team");
    g_TeamNameRed = create_cvar("cn_teamname_red", "Admins", FCVAR_NONE, "Set the name for the admins team");
    g_TeamNameYellow = create_cvar("cn_teamname_yellow", "HLTV", FCVAR_NONE, "Set the name for the HLTV team");
    g_TeamNameGreen = create_cvar("cn_teamname_green", "Green", FCVAR_NONE, "Set the name for the unused green team");
    g_TeamNameGray = create_cvar("cn_teamname_gray", "Gray", FCVAR_NONE, "Set the name for the unused gray team");

    g_ColorPlayer = create_cvar("cn_color_player", "1", FCVAR_NONE, "Set the color for regular players", true, 0.0, true, 5.0);
    g_ColorAdmin = create_cvar("cn_color_admin", "2", FCVAR_NONE, "Set the color for admins", true, 0.0, true, 5.0);
    g_ColorHLTV = create_cvar("cn_color_hltv", "3", FCVAR_NONE, "Set the color for HLTV users", true, 0.0, true, 5.0);
    g_ColorSpectator = create_cvar("cn_color_spectator", "5", FCVAR_NONE, "Set the color for spectators", true, 0.0, true, 5.0);

    hook_cvar_change(g_ColorNames, "fw_CvarChange_Enable");
    hook_cvar_change(g_TeamAdmins, "fw_CvarChange_TeamAdmins");

    hook_cvar_change(g_TeamNameBlue, "fw_CvarChange_TeamName");
    hook_cvar_change(g_TeamNameRed, "fw_CvarChange_TeamName");
    hook_cvar_change(g_TeamNameYellow, "fw_CvarChange_TeamName");
    hook_cvar_change(g_TeamNameGreen, "fw_CvarChange_TeamName");
    hook_cvar_change(g_TeamNameGray, "fw_CvarChange_TeamName");

    hook_cvar_change(g_ColorPlayer, "fw_CvarChange_Color");
    hook_cvar_change(g_ColorAdmin, "fw_CvarChange_Color");
    hook_cvar_change(g_ColorHLTV, "fw_CvarChange_Color");
    hook_cvar_change(g_ColorSpectator, "fw_CvarChange_Color");
#else
    g_ColorNames = register_cvar("cn_enable", "1");
    g_TeamAdmins = register_cvar("cn_team_admins", "1");

    g_TeamNameBlue = register_cvar("cn_teamname_blue", "Players");
    g_TeamNameRed = register_cvar("cn_teamname_red", "Admins");
    g_TeamNameYellow = register_cvar("cn_teamname_yellow", "HLTV");
    g_TeamNameGreen = register_cvar("cn_teamname_green", "Green");
    g_TeamNameGray = register_cvar("cn_teamname_gray", "Gray");

    g_ColorPlayer = register_cvar("cn_color_player", "1");
    g_ColorAdmin = register_cvar("cn_color_admin", "2");
    g_ColorHLTV = register_cvar("cn_color_hltv", "3");
    g_ColorSpectator = register_cvar("cn_color_spectator", "5");
#endif
}

public client_putinserver(id)
{
    if (!!get_pcvar_num(g_ColorNames))
    {
        static iColor;
        static szTeamName[MAX_TEAMNAME];

        static szBlueName[MAX_TEAMNAME];
        static szRedName[MAX_TEAMNAME];
        static szYellowName[MAX_TEAMNAME];
        static szGreenName[MAX_TEAMNAME];
        static szGrayName[MAX_TEAMNAME];

        get_team_and_color(id, iColor, szTeamName);

        get_pcvar_string(g_TeamNameBlue, szBlueName, charsmax(szBlueName));
        get_pcvar_string(g_TeamNameRed, szRedName, charsmax(szRedName));
        get_pcvar_string(g_TeamNameYellow, szYellowName, charsmax(szYellowName));
        get_pcvar_string(g_TeamNameGreen, szGreenName, charsmax(szGreenName));
        get_pcvar_string(g_TeamNameGray, szGrayName, charsmax(szGrayName));

        send_GameMode_msg(1);
        send_TeamInfo_msg(id, szTeamName);
        send_TeamNames_msg(szBlueName, szRedName, szYellowName, szGreenName, szGrayName);
        send_ScoreInfo_msg(id, iColor);
    }
}

#if AMXX_VERSION_NUM > 182
public fw_CvarChange_Enable(pCvar, const szOldVal[], const szNewVal[])
{
    if (str_to_num(szNewVal) >= 1)
    {
        send_GameMode_msg(1);
        static iPlayers[MAX_PLAYERS], iNum;
        get_players(iPlayers, iNum);
        for (new i; i < iNum; i++)
        {
            static iColor;
            get_team_and_color(iPlayers[i], iColor, _);
            send_ScoreInfo_msg(iPlayers[i], iColor);
        }
    }
    else
    {
        send_GameMode_msg(0);
        static iPlayers[MAX_PLAYERS], iNum;
        get_players(iPlayers, iNum);
        for (new i; i < iNum; i++)
            send_ScoreInfo_msg(iPlayers[i], 0);
    }
}

public fw_CvarChange_TeamAdmins(pCvar, const szOldVal[], const szNewVal[])
{
    static iPlayers[MAX_PLAYERS], iNum;
    get_players(iPlayers, iNum);
    for (new i; i < iNum; i++)
    {
        if (is_user_admin(iPlayers[i]))
        {
            static szTeamName[MAX_TEAMNAME];
            get_team_admin(szTeamName);
            send_TeamInfo_msg(iPlayers[i], szTeamName);
        }
    }
}

public fw_CvarChange_TeamName(pCvar, const szOldVal[], const szNewVal[])
{
    g_bUpdateTeamNames = true;
    RequestFrame("NextFrame_Change_TeamName");
}

public NextFrame_Change_TeamName()
{
    if (g_bUpdateTeamNames)
    {
        static szBlueName[MAX_TEAMNAME];
        static szRedName[MAX_TEAMNAME];
        static szYellowName[MAX_TEAMNAME];
        static szGreenName[MAX_TEAMNAME];
        static szGrayName[MAX_TEAMNAME];

        get_pcvar_string(g_TeamNameBlue, szBlueName, charsmax(szBlueName));
        get_pcvar_string(g_TeamNameRed, szRedName, charsmax(szRedName));
        get_pcvar_string(g_TeamNameYellow, szYellowName, charsmax(szYellowName));
        get_pcvar_string(g_TeamNameGreen, szGreenName, charsmax(szGreenName));
        get_pcvar_string(g_TeamNameGray, szGrayName, charsmax(szGrayName));

        send_TeamNames_msg(szBlueName, szRedName, szYellowName, szGreenName, szGrayName);
        g_bUpdateTeamNames = false;
    }
}

public fw_CvarChange_Color(pCvar, const szOldVal[], const szNewVal[])
{
    g_bUpdateColors = true;
    RequestFrame("NextFrame_Change_Color");
}

public NextFrame_Change_Color()
{
    if (g_bUpdateColors)
    {
        static iPlayers[MAX_PLAYERS], iNum;
        get_players(iPlayers, iNum);
        for (new i; i < iNum; i++)
        {
            static iColor;
            get_team_and_color(iPlayers[i], iColor, _);
            send_ScoreInfo_msg(iPlayers[i], iColor);
        }

        g_bUpdateColors = false;
    }
}
#endif

public ev_TeamInfo()
{
    if (!!get_pcvar_num(g_ColorNames))
    {
        new id = read_data(1);

        if (is_spectating(id) && !is_user_hltv(id))
        {
            static szTeamName[0] = EOS;

            send_TeamInfo_msg(id, szTeamName);
            send_ScoreInfo_msg(id, get_pcvar_num(g_ColorSpectator));
        }
    }

    return PLUGIN_CONTINUE;
}

public fw_ScoreInfo_Msg()
{
    if (!!get_pcvar_num(g_ColorNames))
    {
        static id; id = get_msg_arg_int(1);

        if (!is_user_connected(id))
            return PLUGIN_HANDLED;

        static iColor;
        static szTeamName[MAX_TEAMNAME];

        get_team_and_color(id, iColor, szTeamName);

        send_TeamInfo_msg(id, szTeamName);

        set_msg_arg_int(4, ARG_SHORT, iColor);
        set_msg_arg_int(5, ARG_SHORT, iColor);
    }

    return PLUGIN_CONTINUE;
}

get_team_admin(szTeamName[MAX_TEAMNAME])
{
    if (!!get_pcvar_num(g_TeamAdmins))
        szTeamName = "ADMIN";
    else
        szTeamName = "PLAYER";
}

get_team_and_color(id, &iColor = 0, szTeamName[MAX_TEAMNAME] = "")
{
    if (is_user_hltv(id))
    {
        iColor = get_pcvar_num(g_ColorHLTV);
        szTeamName = "HLTV";
    }
    else if (is_spectating(id))
    {
        iColor = get_pcvar_num(g_ColorSpectator);
        szTeamName[0] = EOS;
    }
    else if (is_user_admin(id))
    {
        iColor = get_pcvar_num(g_ColorAdmin);
        get_team_admin(szTeamName);
    }
    else
    {
        iColor = get_pcvar_num(g_ColorPlayer);
        szTeamName = "PLAYER";
    }
}

send_GameMode_msg(enable)
{
    message_begin(MSG_BROADCAST, g_MsgGameMode);
    write_byte(enable);
    message_end();
}

send_TeamInfo_msg(id, szTeamName[])
{
    message_begin(MSG_BROADCAST, g_MsgTeamInfo);
    write_byte(id);
    write_string(szTeamName);
    message_end();
}

send_TeamNames_msg(szBlueName[], szRedName[], szYellowName[], szGreenName[], szGrayName[])
{
    message_begin(MSG_BROADCAST, g_MsgTeamNames);
    write_byte(5);
    write_string(szBlueName);
    write_string(szRedName);
    write_string(szYellowName);
    write_string(szGreenName);
    write_string(szGrayName);
    message_end();
}

send_ScoreInfo_msg(id, iColor)
{
    message_begin(MSG_BROADCAST, g_MsgScoreInfo);
    write_byte(id);
    write_short(get_user_frags(id));
    write_short(get_user_deaths(id));
    write_short(iColor);
    write_short(iColor);
    message_end();
}

bool:is_spectating(id)
{
    return pev_valid(id) == 2 && (get_pdata_int(id, m_afPhysicsFlags) & PFLAG_OBSERVER > 0);
}
Кто нибудь может поправить код этого плагина и сделать так, чтобы в чате были только зеленые ники? Чтобы при нажатии на Tab не было команд, а только обычный список игроков зеленого цвета? Если игрок находится в спектре, то это никому не показывается в таблице. Чтобы не было надписей (Players, Admins, HLTV, Spectator). Я два дня пытался сделать это сам, вырезал куски кода и плагин компилировался без ошибок, но так и не получил того, что хотел. Помогите вырезать все лишнее из этого плагина, чтобы в таблице были просто зеленые ники игроков и в чате тоже зеленые ники игроков и админов наравне. Чтобы не показывало, что админ на сервере и не делило на команды. Разработчики и скриптеры, которые пишут плагины, для вас это дело 5 минут, сделайте пожалуйста этот плагин только зеленого цвета. Зеленые ники игроков. Зеленые ники игроков в таблице. Чтобы не было НИКАКИХ админов Чтобы не было НИКАКИХ HLTV Чтобы не было зрителей (Одна зеленая команда и зеленые ники игроков.)
8 Июн 2025
Я прекрасно понимаю, что этот форум акцентирован на КС 1.6, а мой вопрос по плагину для Half Life, но я думаю, что это единственный форум в котором люди активно общаются и могут помочь.
Это готовый плагин и в данный момент при его работе на сервере всё выглядит так :colornames.png
Но нужно убрать все разделенные команды, что бы было все одним списком и только зеленого цвета. Благодарю за понимание
 

Вложения

Сообщения
30
Реакции
1
Предупреждения
2
https://dev-cs.ru/threads/176/post-196180
Код:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN  "Green Names Only"
#define VERSION "1.0"
#define AUTHOR  "Gramm"

#define GREEN_TEAMNAME "Green"
#define GREEN_COLOR    4 // 4 — зелёный для HL1

#define PFLAG_OBSERVER (1<<5)
#define m_afPhysicsFlags 194

new g_MsgScoreInfo;
new g_MsgTeamInfo;
new g_MsgGameMode;
new g_MsgTeamNames;

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);

    if (!is_running("valve")) {
        log_amx("Plugin stopped: Unsupported mod detected (requires Half-Life 1)");
        pause("d");
    }

    g_MsgScoreInfo = get_user_msgid("ScoreInfo");
    g_MsgTeamInfo  = get_user_msgid("TeamInfo");
    g_MsgGameMode  = get_user_msgid("GameMode");
    g_MsgTeamNames = get_user_msgid("TeamNames");

    register_message(g_MsgScoreInfo, "fw_ScoreInfo_Msg");
    register_event("TeamInfo", "ev_TeamInfo", "a");
}

public client_putinserver(id) {
    if (is_user_hltv(id) || is_spectating(id)) return; // Не показываем HLTV и спектаторов

    send_GameMode_msg(1);
    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    send_TeamNames_msg(GREEN_TEAMNAME);
    send_ScoreInfo_msg(id, GREEN_COLOR);
}

public ev_TeamInfo() {
    new id = read_data(1);
    if (is_user_hltv(id) || is_spectating(id)) return PLUGIN_HANDLED; // Не показываем HLTV и спектаторов

    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    send_ScoreInfo_msg(id, GREEN_COLOR);
    return PLUGIN_HANDLED;
}

public fw_ScoreInfo_Msg() {
    new id = get_msg_arg_int(1);
    if (!is_user_connected(id) || is_user_hltv(id) || is_spectating(id)) return PLUGIN_HANDLED;

    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    set_msg_arg_int(4, ARG_SHORT, GREEN_COLOR);
    set_msg_arg_int(5, ARG_SHORT, GREEN_COLOR);
    return PLUGIN_CONTINUE;
}

send_GameMode_msg(enable) {
    message_begin(MSG_BROADCAST, g_MsgGameMode);
    write_byte(enable);
    message_end();
}

send_TeamInfo_msg(id, const szTeamName[]) {
    message_begin(MSG_BROADCAST, g_MsgTeamInfo);
    write_byte(id);
    write_string(szTeamName);
    message_end();
}

send_TeamNames_msg(const szTeamName[]) {
    message_begin(MSG_BROADCAST, g_MsgTeamNames);
    write_byte(5);
    // Все пять команд называем одинаково, чтобы не было разделения
    for (new i = 0; i < 5; i++) write_string(szTeamName);
    message_end();
}

send_ScoreInfo_msg(id, iColor) {
    message_begin(MSG_BROADCAST, g_MsgScoreInfo);
    write_byte(id);
    write_short(get_user_frags(id));
    write_short(get_user_deaths(id));
    write_short(iColor);
    write_short(iColor);
    message_end();
}

bool:is_spectating(id) {
    return pev_valid(id) == 2 && (get_pdata_int(id, m_afPhysicsFlags) & PFLAG_OBSERVER > 0);
}

bool:is_user_hltv(id) {
    return is_user_hltv(id); // AMXX встроенная функция
}
Попробуйте этот код
 
Сообщения
78
Реакции
13
Gramm, Здравствуйте.
При компиляции вашего кода, 3 ошибки:
1. строка (22): error 017:undefined symbol "is running"
2. строка (99): error 021: symbol already defined: "is_user_hltv"
3. строка (100):error 010:invalid function or declaration
Плагин не компилируется.

Версия компилятора: AMX Mod X 1.9.0.5294
Сервер на ReHLDS version: 3.14.0.857
 
Сообщения
30
Реакции
1
Предупреждения
2
Код:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN  "Green Names Only"
#define VERSION "1.0"
#define AUTHOR  "Gramm"

#define GREEN_TEAMNAME "Green"
#define GREEN_COLOR    4

#define PFLAG_OBSERVER (1<<5)
#define m_afPhysicsFlags 194

new g_MsgScoreInfo;
new g_MsgTeamInfo;
new g_MsgGameMode;
new g_MsgTeamNames;

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);

    if (!is_running("valve")) {
        log_amx("Plugin stopped: Unsupported mod detected (requires Half-Life 1)");
        pause("d");
    }

    g_MsgScoreInfo = get_user_msgid("ScoreInfo");
    g_MsgTeamInfo  = get_user_msgid("TeamInfo");
    g_MsgGameMode  = get_user_msgid("GameMode");
    g_MsgTeamNames = get_user_msgid("TeamNames");

    register_message(g_MsgScoreInfo, "fw_ScoreInfo_Msg");
    register_event("TeamInfo", "ev_TeamInfo", "a");
}

public client_putinserver(id) {
    if (is_user_hltv(id) || is_spectating(id)) return;

    send_GameMode_msg(1);
    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    send_TeamNames_msg(GREEN_TEAMNAME);
    send_ScoreInfo_msg(id, GREEN_COLOR);
}

public ev_TeamInfo() {
    new id = read_data(1);
    if (is_user_hltv(id) || is_spectating(id)) return PLUGIN_HANDLED;

    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    send_ScoreInfo_msg(id, GREEN_COLOR);
    return PLUGIN_HANDLED;
}

public fw_ScoreInfo_Msg() {
    new id = get_msg_arg_int(1);
    if (!is_user_connected(id) || is_user_hltv(id) || is_spectating(id)) return PLUGIN_HANDLED;

    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    set_msg_arg_int(4, ARG_SHORT, GREEN_COLOR);
    set_msg_arg_int(5, ARG_SHORT, GREEN_COLOR);
    return PLUGIN_CONTINUE;
}

send_GameMode_msg(enable) {
    message_begin(MSG_BROADCAST, g_MsgGameMode);
    write_byte(enable);
    message_end();
}

send_TeamInfo_msg(id, const szTeamName[]) {
    message_begin(MSG_BROADCAST, g_MsgTeamInfo);
    write_byte(id);
    write_string(szTeamName);
    message_end();
}

send_TeamNames_msg(const szTeamName[]) {
    message_begin(MSG_BROADCAST, g_MsgTeamNames);
    write_byte(5);
    for (new i = 0; i < 5; i++) write_string(szTeamName);
    message_end();
}

send_ScoreInfo_msg(id, iColor) {
    message_begin(MSG_BROADCAST, g_MsgScoreInfo);
    write_byte(id);
    write_short(get_user_frags(id));
    write_short(get_user_deaths(id));
    write_short(iColor);
    write_short(iColor);
    message_end();
}

bool:is_spectating(id) {
    return pev_valid(id) == PDATA_SAFE && (get_pdata_int(id, m_afPhysicsFlags) & PFLAG_OBSERVER);
}
Исправил, проверьте
 
Сообщения
78
Реакции
13
Исправил, проверьте
Здравствуйте. Два дня пытался сюда зайти, посмотреть сообщение и ответить, но с телефона не получается почему то зайти.
Попробовал скомпилировать ваш плагин. Не компилируется:
1. Строка (22): error 017: undefined symbol "is running"
2. Строка (95): error 017: undefined symbol "PDATA_SAFE"
 
Сообщения
30
Реакции
1
Предупреждения
2
Пробуйте:
Код:
#include <amxmodx>
#include <fakemeta>
#include <amxmisc>

#define PLUGIN  "Green Names Only"
#define VERSION "1.0"
#define AUTHOR  "Gramm"

#define GREEN_TEAMNAME "Green"
#define GREEN_COLOR    4

#define PFLAG_OBSERVER (1<<5)
#define m_afPhysicsFlags 194
#define PDATA_SAFE 2

new g_MsgScoreInfo;
new g_MsgTeamInfo;
new g_MsgGameMode;
new g_MsgTeamNames;

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);

    if (!equal(get_modname(), "valve")) {
        log_amx("Plugin stopped: Unsupported mod detected (requires Half-Life 1)");
        pause("d");
    }

    g_MsgScoreInfo = get_user_msgid("ScoreInfo");
    g_MsgTeamInfo  = get_user_msgid("TeamInfo");
    g_MsgGameMode  = get_user_msgid("GameMode");
    g_MsgTeamNames = get_user_msgid("TeamNames");

    register_message(g_MsgScoreInfo, "fw_ScoreInfo_Msg");
    register_event("TeamInfo", "ev_TeamInfo", "a");
}

public client_putinserver(id) {
    if (is_user_hltv(id) || is_spectating(id)) return;

    send_GameMode_msg(1);
    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    send_TeamNames_msg(GREEN_TEAMNAME);
    send_ScoreInfo_msg(id, GREEN_COLOR);
}

public ev_TeamInfo() {
    new id = read_data(1);
    if (is_user_hltv(id) || is_spectating(id)) return PLUGIN_HANDLED;

    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    send_ScoreInfo_msg(id, GREEN_COLOR);
    return PLUGIN_HANDLED;
}

public fw_ScoreInfo_Msg() {
    new id = get_msg_arg_int(1);
    if (!is_user_connected(id) || is_user_hltv(id) || is_spectating(id))
        return PLUGIN_CONTINUE;

    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    set_msg_arg_int(4, ARG_SHORT, GREEN_COLOR);
    set_msg_arg_int(5, ARG_SHORT, GREEN_COLOR);
    return PLUGIN_CONTINUE;
}

send_GameMode_msg(enable) {
    message_begin(MSG_BROADCAST, g_MsgGameMode);
    write_byte(enable);
    message_end();
}

send_TeamInfo_msg(id, const szTeamName[]) {
    message_begin(MSG_BROADCAST, g_MsgTeamInfo);
    write_byte(id);
    write_string(szTeamName);
    message_end();
}

send_TeamNames_msg(const szTeamName[]) {
    message_begin(MSG_BROADCAST, g_MsgTeamNames);
    write_byte(5);
    for (new i = 0; i < 5; i++) write_string(szTeamName);
    message_end();
}

send_ScoreInfo_msg(id, iColor) {
    message_begin(MSG_BROADCAST, g_MsgScoreInfo);
    write_byte(id);
    write_short(get_user_frags(id));
    write_short(get_user_deaths(id));
    write_short(iColor);
    write_short(iColor);
    message_end();
}

bool:is_spectating(id) {
    return pev_valid(id) == PDATA_SAFE && (get_pdata_int(id, m_afPhysicsFlags) & PFLAG_OBSERVER);
}
 
Сообщения
78
Реакции
13
Gramm, не понимаю, что происходит с форумом, но я теперь вообще не могу зайти на него с телефона и с компьютера из дома. Сейчас получилось зайти только через чужой Wi Fi, нахожусь в гостях. Далеко от дома. Как приеду сразу протестирую ваш код. Заранее благодарю.
 
Сообщения
78
Реакции
13
Gramm,
Привет.Вот наконец то смог зайти на сайт (снова не из дома), по этому так долго не отвечал. Что происходит с форумом? Я три года заходил сразу нормально без проблем и недели две назад все перестало работать и не пускает ни через мобильны интернет ни через домашний.
Попробовал скомпилировать ваш код. Не компилируется.

1 Error.
(compile failed)
ошибка в строке (24): error 088: number of arguments does not match definition
Четверг в 19:31
WILL_BE, не посоветуете ли какой нибудь для телефона на Андроиде (можно в личку, что бы не засорять тему)? Все что я пробовал, ни один не рабочий.
 
Сообщения
30
Реакции
1
Предупреждения
2
Код:
#include <amxmodx>
#include <fakemeta>
#include <amxmisc>

#define PLUGIN  "Green Names Only"
#define VERSION "1.0"
#define AUTHOR  "Gramm"

#define GREEN_TEAMNAME "Green"
#define GREEN_COLOR    4

#define PFLAG_OBSERVER (1<<5)
#define m_afPhysicsFlags 194

new g_MsgScoreInfo;
new g_MsgTeamInfo;
new g_MsgGameMode;
new g_MsgTeamNames;

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);

    // Проверка на мод Half-Life 1 (можно расширить на другие моды)
    if (!equal(get_modname(), "valve")) {
        log_amx("Plugin stopped: Unsupported mod detected (requires Half-Life 1)");
        pause("d");
    }

    g_MsgScoreInfo = get_user_msgid("ScoreInfo");
    g_MsgTeamInfo  = get_user_msgid("TeamInfo");
    g_MsgGameMode  = get_user_msgid("GameMode");
    g_MsgTeamNames = get_user_msgid("TeamNames");

    register_message(g_MsgScoreInfo, "fw_ScoreInfo_Msg", 0); 
    register_event("TeamInfo", "ev_TeamInfo", "a");
}

public client_putinserver(id) {
    if (is_user_hltv(id) || is_spectating(id)) return;

    send_GameMode_msg(1);
    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    send_TeamNames_msg(GREEN_TEAMNAME);
    send_ScoreInfo_msg(id, GREEN_COLOR);
}

public ev_TeamInfo() {
    new id = read_data(1);
    if (is_user_hltv(id) || is_spectating(id)) return PLUGIN_HANDLED;

    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    send_ScoreInfo_msg(id, GREEN_COLOR);
    return PLUGIN_HANDLED;
}

public fw_ScoreInfo_Msg() {
    new id = get_msg_arg_int(1);
    if (!is_user_connected(id) || is_user_hltv(id) || is_spectating(id))
        return PLUGIN_CONTINUE;

    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    set_msg_arg_int(4, ARG_SHORT, GREEN_COLOR);
    set_msg_arg_int(5, ARG_SHORT, GREEN_COLOR);
    return PLUGIN_CONTINUE;
}

send_GameMode_msg(enable) {
    message_begin(MSG_BROADCAST, g_MsgGameMode);
    write_byte(enable);
    message_end();
}

send_TeamInfo_msg(id, const szTeamName[]) {
    message_begin(MSG_BROADCAST, g_MsgTeamInfo);
    write_byte(id);
    write_string(szTeamName);
    message_end();
}

send_TeamNames_msg(const szTeamName[]) {
    message_begin(MSG_BROADCAST, g_MsgTeamNames);
    write_byte(5); // Количество команд (можно изменить, если требуется)
    for (new i = 0; i < 5; i++) write_string(szTeamName);
    message_end();
}

send_ScoreInfo_msg(id, iColor) {
    message_begin(MSG_BROADCAST, g_MsgScoreInfo);
    write_byte(id);
    write_short(get_user_frags(id));
    write_short(get_user_deaths(id));
    write_short(iColor);
    write_short(iColor);
    message_end();
}

bool:is_spectating(id) {
    return (pev_valid(id) && (get_pdata_int(id, m_afPhysicsFlags) & PFLAG_OBSERVER));
}
 
Сообщения
78
Реакции
13
Gramm, не компилируется. Та же самая ошибка, но теперь в двух строках. В (24) и (34)
 
Сообщения
78
Реакции
13
Вы не поверите, но я не пользуюсь соц сетями и мессенджерами. Долго объяснять почему.
 
Сообщения
30
Реакции
1
Предупреждения
2
Valve,
Код:
#include <amxmodx>
#include <fakemeta>
#include <amxmisc>

#define PLUGIN  "Green Names Only"
#define VERSION "1.0"
#define AUTHOR  "Gramm"

#define GREEN_TEAMNAME "Green"
#define GREEN_COLOR    4

#define PFLAG_OBSERVER (1<<5)
#define m_afPhysicsFlags 194

new g_MsgScoreInfo;
new g_MsgTeamInfo;
new g_MsgGameMode;
new g_MsgTeamNames;

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);

    if (!equal(get_modname(), "valve")) {
        log_amx("Plugin stopped: Unsupported mod detected (requires Half-Life 1)");
        pause("d");
    }

    g_MsgScoreInfo = get_user_msgid("ScoreInfo");
    g_MsgTeamInfo  = get_user_msgid("TeamInfo");
    g_MsgGameMode  = get_user_msgid("GameMode");
    g_MsgTeamNames = get_user_msgid("TeamNames");

    register_message(g_MsgScoreInfo, "fw_ScoreInfo_Msg"); // Исправлено
    register_event("TeamInfo", "ev_TeamInfo", "a", "");   // Исправлено
}

public client_putinserver(id) {
    if (is_user_hltv(id) || is_spectating(id)) return;

    send_GameMode_msg(1);
    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    send_TeamNames_msg(GREEN_TEAMNAME);
    send_ScoreInfo_msg(id, GREEN_COLOR);
}

public ev_TeamInfo() {
    new id = read_data(1);
    if (is_user_hltv(id) || is_spectating(id)) return PLUGIN_HANDLED;

    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    send_ScoreInfo_msg(id, GREEN_COLOR);
    return PLUGIN_HANDLED;
}

public fw_ScoreInfo_Msg() {
    new id = get_msg_arg_int(1);
    if (!is_user_connected(id) || is_user_hltv(id) || is_spectating(id))
        return PLUGIN_CONTINUE;

    set_msg_arg_int(4, ARG_SHORT, GREEN_COLOR);
    set_msg_arg_int(5, ARG_SHORT, GREEN_COLOR);
    return PLUGIN_CONTINUE;
}

send_GameMode_msg(enable) {
    message_begin(MSG_BROADCAST, g_MsgGameMode);
    write_byte(enable);
    message_end();
}

send_TeamInfo_msg(id, const sz
 
Сообщения
78
Реакции
13
Gramm, более 10 ошибок во время компиляции. У вас код не до конца дописан в последней строке (71)
 
Сообщения
30
Реакции
1
Предупреждения
2
Valve,
Код:
#include <amxmodx>
#include <fakemeta>
#include <amxmisc>

#define PLUGIN  "Green Names Only"
#define VERSION "1.0"
#define AUTHOR  "Gramm"

#define GREEN_TEAMNAME "Green"
#define GREEN_COLOR    4

#define PFLAG_OBSERVER (1<<5)
#define m_afPhysicsFlags 194

new g_MsgScoreInfo;
new g_MsgTeamInfo;
new g_MsgGameMode;
new g_MsgTeamNames;

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);

    if (!equal(get_modname(), "valve")) {
        log_amx("Plugin stopped: Unsupported mod detected (requires Half-Life 1)");
        pause("d");
    }

    g_MsgScoreInfo = get_user_msgid("ScoreInfo");
    g_MsgTeamInfo  = get_user_msgid("TeamInfo");
    g_MsgGameMode  = get_user_msgid("GameMode");
    g_MsgTeamNames = get_user_msgid("TeamNames");

    register_message(g_MsgScoreInfo, "fw_ScoreInfo_Msg"); // Исправлено
    register_event("TeamInfo", "ev_TeamInfo", "a", "");   // Исправлено
}

public client_putinserver(id) {
    if (is_user_hltv(id) || is_spectating(id)) return;

    send_GameMode_msg(1);
    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    send_TeamNames_msg(GREEN_TEAMNAME);
    send_ScoreInfo_msg(id, GREEN_COLOR);
}

public ev_TeamInfo() {
    new id = read_data(1);
    if (is_user_hltv(id) || is_spectating(id)) return PLUGIN_HANDLED;

    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    send_ScoreInfo_msg(id, GREEN_COLOR);
    return PLUGIN_HANDLED;
}

public fw_ScoreInfo_Msg() {
    new id = get_msg_arg_int(1);
    if (!is_user_connected(id) || is_user_hltv(id) || is_spectating(id))
        return PLUGIN_CONTINUE;

    set_msg_arg_int(4, ARG_SHORT, GREEN_COLOR);
    set_msg_arg_int(5, ARG_SHORT, GREEN_COLOR);
    return PLUGIN_CONTINUE;
}

send_GameMode_msg(enable) {
    message_begin(MSG_BROADCAST, g_MsgGameMode);
    write_byte(enable);
    message_end();
}

send_TeamInfo_msg(id, const szTeamName[]) {
    message_begin(MSG_BROADCAST, g_MsgTeamInfo);
    write_byte(id);
    write_string(szTeamName);
    message_end();
}

send_TeamNames_msg(const szTeamName[]) {
    message_begin(MSG_BROADCAST, g_MsgTeamNames);
    write_byte(1); // Только одна команда
    write_string(szTeamName);
    message_end();
}

send_ScoreInfo_msg(id, iColor) {
    message_begin(MSG_BROADCAST, g_MsgScoreInfo);
    write_byte(id);
    write_short(get_user_frags(id));
    write_short(get_user_deaths(id));
    write_short(iColor);
    write_short(iColor);
    message_end();
}

bool:is_spectating(id) {
    return (pev_valid(id) && (get_pdata_int(id, m_afPhysicsFlags) & PFLAG_OBSERVER)); // Исправлено
}
 
Сообщения
158
Реакции
32
Помог
2 раз(а)
Valve , I have not tested it, corrected some things

C++:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN  "Green Names Only"
#define VERSION "1.0"
#define AUTHOR  "Gramm"

#define GREEN_TEAMNAME "Green"
#define GREEN_COLOR    4

#define PFLAG_OBSERVER (1<<5)
#define m_afPhysicsFlags 194

new g_MsgScoreInfo;
new g_MsgTeamInfo;
new g_MsgGameMode;
new g_MsgTeamNames;

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);

    new szModName[32];
    get_modname(szModName, charsmax(szModName));

    if (!equal(szModName, "valve")) {
        log_amx("Plugin stopped: Unsupported mod detected (requires Half-Life 1)");
        pause("d");
    }

    g_MsgScoreInfo = get_user_msgid("ScoreInfo");
    g_MsgTeamInfo  = get_user_msgid("TeamInfo");
    g_MsgGameMode  = get_user_msgid("GameMode");
    g_MsgTeamNames = get_user_msgid("TeamNames");

    register_message(g_MsgScoreInfo, "fw_ScoreInfo_Msg"); // Исправлено
    register_message(g_MsgTeamInfo, "fw_TeamInfo_Msg");
}

public client_putinserver(id) {
    if (is_user_hltv(id) || is_spectating(id))
        return;

    send_GameMode_msg(1);
    send_TeamInfo_msg(id, GREEN_TEAMNAME);
    send_TeamNames_msg(GREEN_TEAMNAME);
    send_ScoreInfo_msg(id, GREEN_COLOR);
}

public fw_TeamInfo_Msg() {
    new id = get_msg_arg_int(1);
    if (!is_user_connected(id) || is_user_hltv(id) || is_spectating(id))
        return PLUGIN_CONTINUE;

    set_msg_arg_string(2, GREEN_TEAMNAME);
    return PLUGIN_CONTINUE;
}

public fw_ScoreInfo_Msg() {
    new id = get_msg_arg_int(1);
    if (!is_user_connected(id) || is_user_hltv(id) || is_spectating(id))
        return PLUGIN_CONTINUE;

    set_msg_arg_int(4, ARG_SHORT, GREEN_COLOR);
    set_msg_arg_int(5, ARG_SHORT, GREEN_COLOR);
    return PLUGIN_CONTINUE;
}

send_GameMode_msg(enable) {
    message_begin(MSG_BROADCAST, g_MsgGameMode);
    write_byte(enable);
    message_end();
}

send_TeamInfo_msg(id, const szTeamName[]) {
    message_begin(MSG_ONE, g_MsgTeamInfo, _, id);
    write_byte(id);
    write_string(szTeamName);
    message_end();
}

send_TeamNames_msg(const szTeamName[]) {
    message_begin(MSG_BROADCAST, g_MsgTeamNames);
    write_byte(1); // Только одна команда
    write_string(szTeamName);
    message_end();
}

send_ScoreInfo_msg(id, iColor) {
    message_begin(MSG_ONE, g_MsgScoreInfo, _, id);
    write_byte(id);
    write_short(get_user_frags(id));
    write_short(get_user_deaths(id));
    write_short(iColor);
    write_short(iColor);
    message_end();
}

bool:is_spectating(id) {
    return bool:(pev_valid(id) && (get_pdata_int(id, m_afPhysicsFlags) & PFLAG_OBSERVER)); // Исправлено
}
 

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

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