AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   New AMXX Menu System (https://forums.alliedmods.net/showthread.php?t=46364)

Alka 12-28-2007 17:57

Re: New AMXX Menu System
 
You don't need to make button 8 for that option anyway, make it on button 7 or whatever...Buttons "Next / Back" and "Exit" are maded automaticly.

Gizmo 12-28-2007 19:13

Re: New AMXX Menu System
 
What i want is a switch ban times button in a playermenu (all the players on the server in the menu) so each time i press that button it cycle throu the ban times
and when i want to ban a player and press that players name he shall get banned with the bantime value visible in the menu right then, i hope i make sence here :S

Alka 12-29-2007 06:07

Re: New AMXX Menu System
 
Yeah, but with new amxx menu system is a bit hard...because you can't make a button that stays permanently on bottom of page...like in old style menu, but you already have this on "amxmodmenu" ...default by amxmodx.

Gizmo 12-29-2007 09:00

Re: New AMXX Menu System
 
I have been helping Lantz on amxbans alot and i was thinking of trying to use the new menus in amxbans.
I know a way to do it.
Playermenu where you select a player and when you press the player a ban time menu appears and when you select a bantime a reson menu appears but i dont like that way to do it :(

soccdoodcss 01-02-2008 12:29

Re: New AMXX Menu System
 
I believe it would be possible to store the ban time in a global variable. When you press the menu button it should cycle through the ban time once and reshow the menu again. If you understand what I mean?

JFeldon 01-04-2008 18:34

Re: New AMXX Menu System
 
Nice tutorial, helped me. I find this menu system a lot easier, and since I don't often use dynamic menus it's great for me. +Karma ;D

purple_pixie 01-09-2008 08:03

Re: New AMXX Menu System
 
Is there any chance of someone explaining / tutorialising the callback stuff?

IIRC you do something fancy with making a callback handle with a function name, and then passing that in, but the bit I don't really get is how to, say, remove options for a player.

If I took the time and trouble I'm sure I could learn this jazz, but I'm fairly sure someone already has, and isn't that the point of Snippets/Tutorials?

Generally I create / destroy a menu every time it is used, but at times it is useful to adjust a menu on the fly.

Alka 01-09-2008 09:22

Re: New AMXX Menu System
 
Hmm, lemme give you an eg:

Code:

new Menu = menu_create("\ySome Menu", "MenuHandler");
 new CallBack = menu_makecallback("MenuCallBack"); //Here is the trick.
 
 new Players[32], Num, Name[32];
 get_players(Players, Num, "ch");
 
 for(new i = 0 ; i < Num ; i++)
 {
  get_user_name(Players[i], Name, sizeof Name - 1);
 
  menu_additem(Menu, Name, "", 0, CallBack);
 }
 
 menu_display(id, Menu, 0);

This just make the menu and showit to players with callback option.

Code:

new iAccess, Name[32], iCallback;
 menu_item_getinfo(menu, item, iAccess, "", 0, Name, sizeof Name - 1, iCallback);
 
 new Target = get_user_index(Name); //Get the menu item name, in ower case is a player name.
 
 return is_user_admin(Target) ? ITEM_ENABLED : ITEM_DISABLED; //Now, if the Target player is an admin, then he will have the item enabled, else disabled.

This is the "MenuCallBack" public. Here we can disable, enable and skip a menu item. ;)

purple_pixie 01-09-2008 10:13

Re: New AMXX Menu System
 
And I would use menu_item_setname to screw with their text before showing onscreen?

Funky.

And thankyou.

Alka 01-09-2008 11:28

Re: New AMXX Menu System
 
Quote:

Originally Posted by purple_pixie (Post 572169)
And I would use menu_item_setname to screw with their text before showing onscreen?

Funky.

And thankyou.

Yeah, you can do that...oh, and np :wink:


All times are GMT -4. The time now is 05:32.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.