A menus package is now available!

Official Announcements about Source.Python.
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

Postby 8guawong » Wed Nov 12, 2014 11:34 am

Ayuto wrote:No, currently there isn't, but you can create your own timeout by delay-calling <your menu>.close() after sending it.


ic thanks!
8guawong
Senior Member
Posts: 148
Joined: Sat Sep 20, 2014 3:06 am

Postby 8guawong » Tue Nov 18, 2014 2:01 pm

Syntax: Select all

from players.helpers import index_from_userid
from events import Event
from menus import SimpleMenu
from menus import Option
from menus import Text
from listeners.tick import tick_delays

def test_select_callback(menu, ply_index, option):
return

test_menu = SimpleMenu()
test_menu.append(Text('test'))

test_menu.select_callback = test_select_callback

@Event
def player_death(game_event):
userid = game_event.get_int('userid')
index = index_from_userid(userid)
test_menu.send(index)
tick_delays.delay(5, test_menu.close())


like this??

does this close all the menu that was sent to the user??????

if it does how do you close a specific user's menu?
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Tue Nov 18, 2014 2:17 pm

No that would close the menu instantly for all users. You would do something like this.

Syntax: Select all

# ...
tick_delays.delay(5, test_menu.close, index)
But you also need to cancel the delay if the player left the server. Otherwise you will probably get ValueErrors.
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Re: A menus package is now available!

Postby arawra » Sun Aug 14, 2016 8:35 pm

Is 'Option' no longer a part of the menus package?
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: A menus package is now available!

Postby iPlayer » Sun Aug 14, 2016 8:47 pm

There're SimpleOption, PagedOption and ListOption
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
velocity
Senior Member
Posts: 220
Joined: Sat May 10, 2014 6:17 pm

Re: A menus package is now available!

Postby velocity » Mon Oct 10, 2016 12:14 am

When sending a menu to the player through a command and then the player select an option that makes another menu popup. If I then type the command again, it does not send the first menu, it just stays on your current menu
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Re: A menus package is now available!

Postby arawra » Mon Oct 10, 2016 4:30 am

That's correct. If you want to remove the open menu, you'll need to add that functionality in yourself to close the already open menu.

Return to “News & Announcements”

Who is online

Users browsing this forum: No registered users and 4 guests