Half-Life и Adrenaline Gamer форум
http://aghl.ru/forum/

HLSDK (Client) mini_score
http://aghl.ru/forum/viewtopic.php?f=20&t=2575
Страница 1 из 1

Автор:  Gennaro-HL [ 15 окт 2016, 12:26 ]
Заголовок сообщения:  HLSDK (Client) mini_score

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];

 

Автор:  Lev [ 17 окт 2016, 21:03 ]
Заголовок сообщения:  Re: HLSDK (Client) mini_score

Didn't got your problem. Looks like you select 1 player (the best one) and print it (possibly, no code shown).

Автор:  Gennaro-HL [ 28 ноя 2016, 16:16 ]
Заголовок сообщения:  Re: HLSDK (Client) mini_score

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;
}

Изображение

Страница 1 из 1 Часовой пояс: UTC + 5 часов [ Летнее время ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/