PDA

View Full Version : [Question] About Menu Stuff


SamuraiBarbi
09-13-2007, 14:42
Hello, I've just got a couple questions
1) Is there a way to skip choice numbers when building a menu in SourceMod? For instance, I want to display choices 1, 2 and then skip to 7, 8, and 9. See the picture if you need a visual explanation.
http://downloads.daedalus-online.net/downloads_css/shotgun.jpg

2) When formatting a menu is it possible to display line breaks without having to do \n ? It's not a problem yet, but it's just ugly when I have to do this

new Handle:menu = CreateMenu(MenuHandler1);
SetMenuTitle(menu, "Welcome to KiLL Machine\nServer IP: 72.36.233.18:27015\n \nBuy Menus:");
AddMenuItem(menu, "weapon", "Buy Weapon");
AddMenuItem(menu, "equipment", "Buy Equipment\n \n");
AddMenuItem(menu, "rebuy", "Re-Buy Previous - $2500\n \n \n");

AddMenuItem(menu, "mapstats", "View Map Stats\n");
AddMenuItem(menu, "teamstats", "View Team Stats\n");
AddMenuItem(menu, "mystats", "View My Stats\n");
AddMenuItem(menu, "close", "Close\n \nSay menu to bring this menu up at any time");

SetMenuExitButton(menu, false);
DisplayMenu(menu, client, 20);

return Plugin_Handled;


in order to display this
http://downloads.daedalus-online.net/downloads_css/menu.jpg

Nican
09-13-2007, 16:38
Let's see... the AddMenuItem:

native AddMenuItem(Handle:menu,
const String:info[],
const String:display[],
style=ITEMDRAW_DEFAULT);


The ITEMDRAW_ defines:

#define ITEMDRAW_DEFAULT (0) /**< Item should be drawn normally */
#define ITEMDRAW_DISABLED (1<<0) /**< Item is drawn but not selectable */
#define ITEMDRAW_RAWLINE (1<<1) /**< Item should be a raw line, without a slot */
#define ITEMDRAW_NOTEXT (1<<2) /**< No text should be drawn */
#define ITEMDRAW_SPACER (1<<3) /**< Item should be drawn as a spacer, if possible */
#define ITEMDRAW_IGNORE ((1<<1)|(1<<2)) /**< Item should be completely ignored (rawline + notext) */
#define ITEMDRAW_CONTROL (1<<4) /**< Item is control text (back/next/exit) */


I think you are suppose to use ITEMDRAW_RAWLINE as style...


have you tried using InsertMenuItem (http://sm.nican132.com/index.php?fastload=show&id=159)?

SamuraiBarbi
09-13-2007, 16:55
no, i hadn't tried that yet. thanks! hopefully this will go a long way towards helping style the menu's. :D

SamuraiBarbi
05-11-2009, 03:27
Sorry to resurrect a dead thread but I never was able to figure out how exactly to get this working like I intended it to. I'd like to clarify one of my questions since I don't think I did a good job of explaining what I was trying to do before.

Is it possible to draw a menu and skip item selections, IE show menu item 1, menu item 2, a blank line, a blank line, a blank line, a blank line, menu item 7?

Here's a visual example:

1: Some option
2: Alternative option




7: Some other option

I was able to pull this off in Eventscripts using popup addline so I know it's possible, the only questions in my mind are, is it possible to do in Sourcemod and how?

bl4nk
05-11-2009, 03:32
Just use ITEMDRAW_SPACER for the flags, and it should put in a blank line.

SamuraiBarbi
05-11-2009, 04:08
Thx! That was pretty much exactly what I was looking for :D

I have another question relating to menus. How do I make a radio style menu? When I used this code

public func_createMenu(client)
{
new Handle:hMenu = CreateMenuEx(MenuStyle_Valve,fn_MenuHandler);

SetMenuTitle(hMenu,"My Awesome menu");

AddMenuItem(hMenu,"Option 1","Option #1");
AddMenuItem(hMenu,"Option 2","Option #2");
AddMenuItem(hMenu,"Option 3","Option #3");


DisplayMenu(hMenu,client,MENU_TIME_FOREVER);
}

public fn_MenuHandler(Handle:menu, MenuAction:action, param1, param2)
{
// stuff
}

but use MenuStyle_Radio instead of MenuStyle_Valve I get a tag mismatch error. Heck even if I leave it as MenuStyle_Vavle I get the error. I would just do more research to find the answer but there doesn't seem to be many examples of people specifying menu styles on the forums.

SamuraiBarbi
05-11-2009, 04:23
oooo! nevermind, i found the answer to that question by digging furiously through approved plugins that dealt with menus.

I should have been doing


CreateMenuEx(GetMenuStyleHandle(MenuStyle_Rad io), fn_MenuHandler);