Display of messages at the beginning of the round

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
237
Реакции
10
Hello.

I have a plugin that displays a message about the best player at the beginning of the round (before freezetime).

I have an event applied:
Код:
register_event ("HLTV", "New_Round", "a", "1 = 0", "2 = 0")
The problem is that the message is not always displayed, because this event often skips random rounds.

What event to apply so that the message will always be shown without skipping any rounds (not after freezetime, only before freezetime!)
 
Сообщения
494
Реакции
340
Помог
11 раз(а)
Код:
#include <amxmodx>
#include <reapi>

public plugin_init()
{
    RegisterHookChain(RG_CSGameRules_RestartRound, "CSGameRules_RestartRound_Post", true);
}

public CSGameRules_RestartRound_Post()
{
    // code
}
 
  • Нравится
Реакции: Fiji
Сообщения
494
Реакции
340
Помог
11 раз(а)
pmadisson75, так можно долго гадать о вашей проблеме. Ровно до тех пор, пока вы не предоставите исходный код.
 
Сообщения
237
Реакции
10
Код:
#include <amxmodx>

#define ForPlayers(%1) for(new %1 = 1; %1 <= 32; %1++)

new const minimumRounds = 0;
new const Float:killsMultiplier = 1.5;

new currentRound,

bestUser = -1;

public plugin_init()
{
    register_event("SendAudio", "getCurrentLeader", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin");
    register_event("HLTV", "New_Round", "a", "1=0", "2=0")
}

public New_Round()
{
    currentRound = 0;

    if(!is_user_connected(bestUser))
    {
        return;
    }

    new userName[33];
    get_user_name(bestUser, userName, charsmax(userName));

    client_print_color(0, print_team_default, "Map leader: %s | Frags: %i | Deaths: %i", userName, get_user_frags(bestUser), get_user_deaths(bestUser));
}

. . . .
 
Последнее редактирование:
Сообщения
494
Реакции
340
Помог
11 раз(а)
pmadisson75, где сам алгоритм вычисления лучшего игрока?
Если он в переменную betUser не заносит значение, то в в событии старта раунда ничего не выводится, ибо там стоит проверка.
 
Сообщения
237
Реакции
10
I shared part of it myself.
My point is that the message is not always displayed. when I give the event after freezetime it's ok, but there is a problem at the NewRound event
 
Сообщения
494
Реакции
340
Помог
11 раз(а)
pmadisson75, покажите вариант с использованием reapi. Пример которого я давал выше. Когда вы сказали, что сообщения теперь совсем не показываются.
 
Сообщения
494
Реакции
340
Помог
11 раз(а)
Код:
#include <amxmodx>
#include <reapi>

new g_pMapLeader;

public plugin_init()
{
    RegisterHookChain(RG_CSGameRules_RestartRound, "CSGameRules_RestartRound_Post", true);
    RegisterHookChain(RG_RoundEnd, "RoundEnd_Post", true);
}

public client_disconnected(pPlayer)
{
    if(g_pMapLeader == pPlayer)
        g_pMapLeader = NULLENT;
}

public CSGameRules_RestartRound_Post()
{
    if(g_pMapLeader != NULLENT)
        client_print_color(0, print_team_default, "^1Map leader:^4 %n ^1| Frags:^4 %i^1 | Deaths:^4 %i", g_pMapLeader, floatround(get_entvar(g_pMapLeader, var_frags)), get_member(g_pMapLeader, m_iDeaths));
    else
        client_print_color(0, print_team_default, "Map leader: ^4not identified");
}

public RoundEnd_Post()
{
    g_pMapLeader = NULLENT;

    new
        pPlayers[MAX_PLAYERS],
        iPlayersCount,
        pPlayer,
        iSubValue,
        iSubMax;

    get_players(pPlayers, iPlayersCount, "h");

    for(new i; i < iPlayersCount; i++)
    {
        pPlayer = pPlayers[i];
        iSubValue = floatround(get_entvar(pPlayer, var_frags)) - get_member(pPlayer, m_iDeaths);

        if(iSubValue > iSubMax)
        {
            iSubMax = iSubValue;
            g_pMapLeader = pPlayer;
        }
    }
}
 
Последнее редактирование:
  • Нравится
Реакции: Murz
Сообщения
237
Реакции
10
This is not the plugin I have. Badly calculates the best player on the map.

Barzo wants someone to help me change the event used to display the message
 
Сообщения
237
Реакции
10
It's already ok.

The topic can be closed.

Тему можно закрывать.
 
Статус
В этой теме нельзя размещать новые ответы.

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

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