UserMessage Menu
UserMessage Menu
for some reason i can only hit option 1 in menu......
UserMessage = GameEngine.UserMessageBegin(Recipients, 10, None)
UserMessage.WriteShort(1)
UserMessage.WriteByte(2)
UserMessage.WriteByte(0)
UserMessage.WriteString(text)
GameEngine.MessageEnd()
when i change the highlighted i can choose more options but i would really like some information on what types/bytes/shorts to edit for me to have a menu with 10 menuselect 0 included
UserMessage = GameEngine.UserMessageBegin(Recipients, 10, None)
UserMessage.WriteShort(1)
UserMessage.WriteByte(2)
UserMessage.WriteByte(0)
UserMessage.WriteString(text)
GameEngine.MessageEnd()
when i change the highlighted i can choose more options but i would really like some information on what types/bytes/shorts to edit for me to have a menu with 10 menuselect 0 included
-Tuck
You can use this helper function in order to get the required value:
If you want to enable 0-9 you would do it like the following:
Syntax: Select all
def keysToBits(keys):
return sum((1 << x for x in set(keys)))
If you want to enable 0-9 you would do it like the following:
Syntax: Select all
UserMessage.WriteShort(keysToBits((0, 1, 2, 3, 4, 5, 6, 7, 8, 9)))
# Or more simple
UserMessage.WriteShort(keysToBits(range(9)))
- L'In20Cible
- Project Leader
- Posts: 1533
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
- L'In20Cible
- Project Leader
- Posts: 1533
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
Hey guys,
I don't think that we can do anything server-side since slots are handled by clients: CBaseHudWeaponSelection::HandleHudMenuInput. Then, it tells the server by sending menuselect: CHudMenu::SelectMenuItem. I compared the file ../game/client/weapon_selection.cpp from CSS to CS:GO and it seems that thr problem is at line 254:The menu never handles the selection if the slot is not between 1 and 9. So well, there's really nothing we can do...
Anyways, Ayuto's function is wrong. It should be:Where "0" need to be handled as "10".
L'In20Cible
I don't think that we can do anything server-side since slots are handled by clients: CBaseHudWeaponSelection::HandleHudMenuInput. Then, it tells the server by sending menuselect: CHudMenu::SelectMenuItem. I compared the file ../game/client/weapon_selection.cpp from CSS to CS:GO and it seems that thr problem is at line 254:
Syntax: Select all
if ( down >= 1 && keynum >= KEY_1 && keynum <= KEY_9 )
{
if ( HandleHudMenuInput( keynum - KEY_0 ) )
return 0;
}
Anyways, Ayuto's function is wrong. It should be:
Syntax: Select all
def keysToBits(keys):
return sum((1 << (x - 1) for x in set(keys)))
L'In20Cible
- L'In20Cible
- Project Leader
- Posts: 1533
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
- L'In20Cible
- Project Leader
- Posts: 1533
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
- L'In20Cible
- Project Leader
- Posts: 1533
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
No you can't force a client to bind a key. And I doubt you can get which command is bound to it since the server doesn't have to know that directly so well, why sending more data than needed? Not sure if it works on CSGO but on CSS, you can print them into a hudhint message. In example:
L'In20Cible
Code: Select all
Press %+jump% to jump!
L'In20Cible
L'In20Cible wrote:No you can't force a client to bind a key. And I doubt you can get which command is bound to it since the server doesn't have to know that directly so well, why sending more data than needed? Not sure if it works on CSGO but on CSS, you can print them into a hudhint message. In example:Code: Select all
Press %+jump% to jump!
L'In20Cible
i think %+jump% is converted client side :/
-Tuck
- L'In20Cible
- Project Leader
- Posts: 1533
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
Return to “Plugin Development Support”
Who is online
Users browsing this forum: Bing [Bot] and 33 guests