Page 1 of 1

[CS:S] Closing a SP menu when a SM menu is sent.

Posted: Sat Feb 20, 2021 3:49 pm
by Kami
Hey guys,

I noticed that SP does not play well with SM menus. If you open a SP menu and a SM menu after that the SM menu will come up shortly and be replaced by the SP menu quickly. If I go the other way around and open SM first and SP second it does work without any problems. How would I go about closing the current SP menu if a new SM menu is sent?

I used this code for testing:

Syntax: Select all

from menus import SimpleMenu, SimpleOption
from events import Event
from players.entity import Player


def __select(menu,index,choice):
print(choice.choice_index)

@Event('player_say')
def _say(ev):
if ev['text'] == "test":
player = Player.from_userid(ev['userid'])
menu = SimpleMenu(select_callback=__select)
menu.append("Test me")
menu.append(SimpleOption(1,"Yes"))
menu.append(SimpleOption(2,"No"))
menu.append(SimpleOption(0,"Close"))
menu.send(player.index)