Время игры во время матча

SPRATAY

Участник
Сообщения
32
Реакции
4
Я сдаюсь:
Проще говоря хочу что бы в название сервера показывало как на табло матча,и отлючался после завершения:
C++:
public Action MatchPeriodTimer(Handle timer, any time)
{
    //int matchLength = matchPeriods * matchPeriodLength;
    //GameRules_SetPropFloat("m_fRoundStartTime", GetGameTime() - float(GameRules_GetProp("m_iRoundTime")) + matchLength - matchTime);
    matchTime = time;
    char timeString[16];
    char RealHostname[128];
  

    GetConVarString(FindConVar("hostname"), RealHostname, sizeof(RealHostname));
    getTimeString(timeString, matchTime);
    [COLOR=rgb(184, 49, 47)]PrintHintTextToAll("CT %i - %i T | %s", matchScoreCT, matchScoreT, timeString); %s = показывает веремя например 00:50 [/COLOR]
   [COLOR=rgb(184, 49, 47)] ServerCommand("hostname \"%s %i\"", RealHostname, timeString);%s название сервера, %i показывает больше того числа которое я указывал(и кстати если не убрать %s после название сервера будет тупо копировать числа а не обновлять их)[/COLOR]

    int periodEnd = matchPeriod * matchPeriodLength;
    if (time < periodEnd) matchTimer = CreateTimer(1.0, MatchPeriodTimer, time + 1);
    else
    {
        matchStoppageTimeStarted = true;

        int index = CreateEntityByName("trigger_once");
        if (index != -1)
        {
            DispatchKeyValue(index, "targetname", "end_stoppage_time");
            DispatchKeyValue(index, "spawnflags", "8");

            DispatchSpawn(index);
            ActivateEntity(index);

            TeleportEntity(index, matchBallStartPosition, NULL_VECTOR, NULL_VECTOR);

            if (!IsModelPrecached("models/props/cs_office/vending_machine.mdl")) PrecacheModel("models/props/cs_office/vending_machine.mdl");
            SetEntityModel(index, "models/props/cs_office/vending_machine.mdl");

            float minbounds[3] = {-2000.0, -1.0, -10.0};
            float maxbounds[3] = {2000.0, 1.0, 5000.0};
            SetEntPropVector(index, Prop_Send, "m_vecMins", minbounds);
            SetEntPropVector(index, Prop_Send, "m_vecMaxs", maxbounds);

            SetEntProp(index, Prop_Send, "m_nSolidType", 2);

            int enteffects = GetEntProp(index, Prop_Send, "m_fEffects");
            enteffects |= 32;
            SetEntProp(index, Prop_Send, "m_fEffects", enteffects);
        }

        matchTimer = CreateTimer(0.0, MatchPeriodStoppageTimer, matchStoppageTime);
    }
}
 
Последнее редактирование:

Grey83

не пишу плагины с весны 2022
Сообщения
8,520
Реакции
4,979
для кода используй теги [CODE=cpp][/CODE]
 

Grey83

не пишу плагины с весны 2022
Сообщения
8,520
Реакции
4,979
кстати, тебе нужно получать значение RealHostname из квара при старте плагина, а не в таймере
 
Сверху Снизу