Half-Life и Adrenaline Gamer форум

Всё об игре в Халф-Лайф и АГ
Текущее время: 28 мар 2024, 21:10

Часовой пояс: UTC + 5 часов [ Летнее время ]




Начать новую тему Ответить на тему  [ Сообщений: 3 ] 
Автор Сообщение
 Заголовок сообщения: HLSDK (Client) mini_score
СообщениеДобавлено: 15 окт 2016, 12:26 
Не в сети
Аватара пользователя
Зарегистрирован:
09 фев 2015, 02:46
Последнее посещение:
19 июл 2018, 16:07
Сообщения: 91
Откуда: Endcamp
As achievement to show only the top ranking
I'm trying to copy cl_score ag
help?
Код:
int PlayersTOP = CVAR_GET_FLOAT("hud_mini_score_player_rank");
   
   while (1)
   {
      // Find the top ranking player
      int highest_frags = -99999;
      int lowest_deaths = 99999;
      int best_player = 0;

      //for (int i = 1; i < MAX_PLAYERS; i++)//example shows 32 players (IMG1)
      //for (int i = 1; i < 1; i++)//example shows 0 players
      for (int i = 1; i < 2; i++)//example shows 1 players but the operation is wrong (IMG2) does not show the player with the most points
      {
         if (g_PlayerInfoList[i].name && g_PlayerExtraInfo[i].frags >= highest_frags)
         {
            if (!(team && stricmp(g_PlayerExtraInfo[i].teamname, team)))  // make sure it is the specified team
            {
               extra_player_info_t *pl_info = &g_PlayerExtraInfo[i];
               if (pl_info->frags > highest_frags || pl_info->deaths < lowest_deaths)
               {
                  best_player = i;
                  lowest_deaths = pl_info->deaths;
                  highest_frags = pl_info->frags;
               }
            }
         }
      }
      if (!best_player)
         break;

      hud_player_info_t *pl_info = &g_PlayerInfoList[best_player];

 

_________________
Gennaro.R+
Изображение


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: HLSDK (Client) mini_score
СообщениеДобавлено: 17 окт 2016, 21:03 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
26 мар 2024, 21:42
Сообщения: 6864
Didn't got your problem. Looks like you select 1 player (the best one) and print it (possibly, no code shown).


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: HLSDK (Client) mini_score
СообщениеДобавлено: 28 ноя 2016, 16:16 
Не в сети
Аватара пользователя
Зарегистрирован:
09 фев 2015, 02:46
Последнее посещение:
19 июл 2018, 16:07
Сообщения: 91
Откуда: Endcamp
Hi, I'm relive this for a question.
You can cut the line_slot so you do not create more lines than I want

Examples:
Create 1 line_slot = 1 top rank player
Create 5 line_slot = 5 top rank players

Similar to client AG

Something like the top line of saytext

Код:
int CHudMiniScore::DrawPlayers(float line_slot, char *team)
{
   int R, G, B;
   gHUD.GetHudColor(0, 0, R, G, B);

   while (1)
   {
      int highest_frags = -99999;
      int lowest_deaths = 99999;
      int best_player = 0;

      for (int i = 1; i < MAX_PLAYERS; i++)
      {
         if (g_PlayerInfoList[i].name && g_PlayerExtraInfo[i].frags >= highest_frags)
         {
            if (!(team && stricmp(g_PlayerExtraInfo[i].teamname, team)))
            {
               extra_player_info_t *pl_info = &g_PlayerExtraInfo[i];
               if (pl_info->frags > highest_frags || pl_info->deaths < lowest_deaths)
               {
                  best_player = i;
                  lowest_deaths = pl_info->deaths;
                  highest_frags = pl_info->frags;
               }
            }
         }
      }

      if (!best_player)
         break;

      int xpos = 50;
      int ypos = 50 + (line_slot * 20) + 5;

      if (ypos > ScreenHeight - 50)
         break;

      char szNameScore[200];

      sprintf(szNameScore, "%s   %d", g_PlayerInfoList[best_player].name, g_PlayerExtraInfo[best_player].frags);

      gHUD.DrawHudStringColor(xpos, ypos, ScreenWidth, szNameScore, R, G, B, 1);

      g_PlayerInfoList[best_player].name = NULL;

      line_slot++;
   }

   return line_slot;
}

Изображение

_________________
Gennaro.R+
Изображение


Вернуться к началу
 Профиль 
  
Показать сообщения за:  Поле сортировки  
Начать новую тему Ответить на тему  [ Сообщений: 3 ] 

Часовой пояс: UTC + 5 часов [ Летнее время ]


Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 4


Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете добавлять вложения

Найти:
Перейти:  
Создано на основе phpBB® Forum Software © phpBB Group
Русская поддержка phpBB