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

hlsdk .dll (Players menu help)
http://aghl.ru/forum/viewtopic.php?f=20&t=2633
Страница 1 из 1

Автор:  Gennaro-HL [ 01 фев 2017, 00:58 ]
Заголовок сообщения:  hlsdk .dll (Players menu help)

Hi i want to get the same effect as this: PlayerMenu

In the menu that I believe only shows me to the very player that connected

Код:
else if (FStrEq(CMD_ARGV(0), "menu_players"))
   {
      for (int i = 1; i <= gpGlobals->maxClients; i++)
      {
         CBasePlayer* pPlayerLoop = AgPlayerByIndex(i);
         if (pPlayerLoop)
         {
            char szText[100];

            pPlayerLoop += sprintf(szText, "%s", pPlayerLoop->GetName());

            g_engfuncs.pfnServerPrint(UTIL_VarArgs("%s\n", szText));//Test ->
            // Player1
            // Player2

            MESSAGE_BEGIN(MSG_ONE, gmsgShowMenu, NULL, pPlayer->pev);
            WRITE_SHORT(1 + 2 + 16);//this is correct?
            WRITE_CHAR(-1);
            WRITE_BYTE(0);
            WRITE_STRING(UTIL_VarArgs("%s\n", szText));// Test -> (Player2) First Player1 is not
            MESSAGE_END();
         }
      }

      return true;
   }

Автор:  Lev [ 05 фев 2017, 07:23 ]
Заголовок сообщения:  Re: hlsdk .dll (Players menu help)

Not sure what you want. There is a lot of info in the link.
Try to be more specific.

Автор:  Gennaro-HL [ 05 фев 2017, 15:37 ]
Заголовок сообщения:  Re: hlsdk .dll (Players menu help)

What I want is to create an online player menu

This is a plugin
Изображение

I want to create the same but from the hlsdk(hl.dll)

The problem does not create a player list
Изображение

Player 2 replaces player 1

Understood?

Автор:  Lev [ 05 фев 2017, 20:46 ]
Заголовок сообщения:  Re: hlsdk .dll (Players menu help)

You should look at MsgFunc_ShowMenu in menu.cpp for message parameters. They are acquired from the message via READ_xxx functions. In the order.
For example
Код:
   BEGIN_READ( pbuf, iSize );
   m_bitsValidSlots = READ_SHORT();
   int DisplayTime = READ_CHAR();
   int NeedMore = READ_BYTE();
First in the message should be a value of a valid slots (short is 2 bytes long), then display time (char is 1 byte long). Etc...
Also, you can send several messages for the one menu to combine string up to 512 characters. For this you should send 1 in NeedMore for all messages except last one where it should be 0.
About m_bitsValidSlots value. I suppose it is starting from 1. So bit 1 is for enabling slot1 command, 2 for slot2 and 10 for slot10. So, you need to set bits for player numbers in the list plus additional items like exit, etc. You can send just 1 for first messages and send actual value in the last message. So you can collect needed bits while sending player names.

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