Raised This Month: $51 Target: $400
 12% 

New AMXX Menu System


Post New Thread Reply   
 
Thread Tools Display Modes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-25-2011 , 22:13   Re: New AMXX Menu System
Reply With Quote #331

Quote:
Originally Posted by Erox902 View Post
2nd: That would be awesome! But isn't that only possible with oldmenus?
Yes.
__________________
fysiks is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 05-26-2011 , 02:42   Re: New AMXX Menu System
Reply With Quote #332

I'll try to write a new example for doing complex sub menus, that use the same menu handler.

As always, donations help motivate me to put more tutorials out there for people.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 05-26-2011 , 10:43   Re: New AMXX Menu System
Reply With Quote #333

fysiks: are there any tutorials out on how to do this or should i check the slapmenus amxx?...
could only find this http://forums.alliedmods.net/showthread.php?t=14637 about the old menu system and that didn't really help

Emp`: that would always be appreciated
Erox902 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-26-2011 , 14:33   Re: New AMXX Menu System
Reply With Quote #334

Quote:
Originally Posted by Erox902 View Post
fysiks: are there any tutorials out on how to do this or should i check the slapmenus amxx?...
Look in plmenu.sma to see how it's done for the slap menu.
__________________
fysiks is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 05-30-2011 , 08:15   Re: New AMXX Menu System
Reply With Quote #335

Quote:
Originally Posted by fysiks View Post
Look in plmenu.sma to see how it's done for the slap menu.
Ok I've looked at it and I think I understand most of it...
but anyhow do you know any other good (little more advanced)
tutorials on the old menu system?...
the only one I found (linked in my old post) wasn't very great and not that well explained :/
Erox902 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-30-2011 , 13:43   Re: New AMXX Menu System
Reply With Quote #336

Quote:
Originally Posted by Erox902 View Post
do you know any other good (little more advanced)
tutorials on the old menu system?...
the only one I found (linked in my old post) wasn't very great and not that well explained :/
Other plugins.
__________________
fysiks is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 09-28-2011 , 16:28   Re: New AMXX Menu System
Reply With Quote #337

Quote:
Originally Posted by fysiks View Post
Yes.
(About this only doable with old menus)

Figured out a way around this not sure if it's a good way thou

PHP Code:
#define MAX_EXAMPLES 3

new const EXAMPLES[MAX_EXAMPLES][]=
{
   
"10""15""20"
}

new 
gSelectedExample[id]

--------------------------------------------

public 
show_menu(id)
{
   new 
menu menu_create("Example #1""handleExample")
   
   static 
Selected[16]
   
formatexSelectedcharsmax(Selected), "amount: %d"EXAMPLES[gSelectedExample[id]] )

   
menu_additem(Selected"1")
   ... 
skipping
}

public 
handleExample(idmenuitem)
{
  ..... 
skipping

  
case 1:
  {
      
gSelectedExample[id]++

      if(
gSelectedExample[id] > MAX_EXAMPLES-1
         gSelectedExample
[id] = 0;

      
show_menu(id)
    }


Last edited by Erox902; 09-28-2011 at 16:30.
Erox902 is offline
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 09-28-2011 , 17:01   Re: New AMXX Menu System
Reply With Quote #338

Hey I got aware of this new type of menu just by today (always used the old style O.o)

So I was wondering how to merge these 2 menu parts.
old one:
PHP Code:
public select_class(id,lx[])
{
    if(
is_user_bot(id)) return
    new 
flags[11]
    
get_cvar_string("diablo_classes",flags,10)
    new 
text[512]
    new 
keys read_flags(flags)
    
    
asked_klass[id]=0
    
    format
(text511,"\ySelect Class - ^n")
    
    for(new 
i=0;i<9;i++)
    {
        
format(text511,"%s%s%d. %s  Level :%d ^n",text,(keys)&(1<<i)?"\w":"\d",i+1,Race[i+1], lx[i+1])
    }
    

    
show_menu(idkeystext

The new one:
PHP Code:
public select_class(id,lx)
{
    if(
is_user_bot(id)) return
    
asked_klass[id]=0
    
    
new menu menu_create("\rSelect class:""select_class_menu");
    
menu_additem(menu"\wMage""1"0);
    
menu_additem(menu"\wMonk""2"0);
    
menu_additem(menu"\wPaladin""3"0);
    
menu_additem(menu"\wAssassin""4"0);
    
menu_additem(menu"\wNecromancer""5"0);
    
menu_additem(menu"\wBarbarian""6"0);
    
menu_additem(menu"\wNinja""7"0);
    
menu_additem(menu"\wDemonHunter""8"0);
    
menu_additem(menu"\wPirate""9"0);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);

As in the old menu I got certain access flags which could disallow people to pick certain classes per map (defined by cvars). And also when they see the menu they can see the current level.

Thanks in advance
egbertjan is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-29-2011 , 00:59   Re: New AMXX Menu System
Reply With Quote #339

PHP Code:
public select_class(id,lx)
{
    if(
is_user_bot(id))
    {
        return
    }

    
asked_klass[id]=0

    
// Make the menu static so we don't need to format it and destroy it each time
    
static iMenu = -1
    
if( iMenu == -)
    {
        
iMenu menu_create("\rSelect class:""select_class_menu");
        new 
iCallBack menu_makecallback("CheclItemEnabled");

        
// native menu_additem(menu, const name[], const info[]="", paccess=0, callback=-1);
        
menu_additem(iMenu"\wMage", .callback iCallBack); // item = 0
        
menu_additem(iMenu"\wMonk", .callback iCallBack); // item = 1
        
menu_additem(iMenu"\wPaladin", .callback iCallBack); // etc..
        
menu_additem(iMenu"\wAssassin", .callback iCallBack);
        
menu_additem(iMenu"\wNecromancer", .callback iCallBack);
        
menu_additem(iMenu"\wBarbarian", .callback iCallBack);
        
menu_additem(iMenu"\wNinja", .callback iCallBack);
        
menu_additem(iMenu"\wDemonHunter", .callback iCallBack);
        
menu_additem(iMenu"\wPirate", .callback iCallBack);
        
// menu_setprop(menu, MPROP_EXIT, MEXIT_ALL); // default setting, so it is useless
    
}
    
menu_display(idiMenu);
}

// This callback is called when the menu is being shown to user
public CheclItemEnabled(idiMenuiItem)
{
    static 
diablo_classes
    
if( !diablo_classes )
    {
        
diablo_classes get_cvar_pointer("diablo_classes"// do this in plugin_init...
    
}
    new 
szFlags[11]
    
get_pcvar_string(diablo_classesszFlagscharsmax(szFlags))
    new 
iKeys read_flags(flags)

    return 
iKeys & (1<<iItem) ? ITEM_ENABLED ITEM_DISABLED // this will enable/disable the menu by disabling client keys and formatting with \d if disabled
}

public 
select_class_menu(idiMenuiItem)
{
    if( 
iItem != MENU_EXIT )
    {
        
asked_klass[id] = iItem // i guess you have to put + 1 because items starts to 0
    
}
    return 
PLUGIN_HANDLED

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 09-29-2011 , 12:17   Re: New AMXX Menu System
Reply With Quote #340

The compiling doesn't work. Perhaps some useful information: it's used for Diablo Mod version 5.9 if you need the default script it's linked: http://amxx.pl/topic/8621-diablo-mod-59l-sql/

P.S. the classes restriction goes with a cvar from a-i (every class it's own letter).

Edit:
This is my current menu (old style)

PHP Code:

public select_class(id,lx[])
{
    if(
is_user_bot(id)) return
    new 
flags[11]
    
get_cvar_string("diablo_classes",flags,10)
    new 
text[512]
    new 
keys read_flags(flags)
    
    
asked_klass[id]=0
    
    format
(text511,"\ySelect Class - ^n")
    
    for(new 
i=0;i<9;i++)
    {
        
format(text511,"%s%s%d. %s  Level :%d ^n",text,(keys)&(1<<i)?"\w":"\d",i+1,Race[i+1], lx[i+1])
    }
    

    
show_menu(idkeystext
}

public 
select_class_menu(idkey

    
g_haskit[id] = 0
    
switch(key
    { 
        case 
0
        {    
            
player_class[id] = Mage    
            
        
}
        case 
1
        {    
            
player_class[id] = Monk
            
        
}
        case 
2
        {    
            
player_class[id] =  Paladin
            
for (new i=033i++){
            
count_jumps(i)
            
JumpsLeft[i]=JumpsMax[i]
            
        }
                            
        }
        case 
3
        {    
            
player_class[id] = Assassin
            
        
}
        case 
4
        {            
            
player_class[id] = Necromancer
            g_haskit
[id] = 1
            
        
}
        case 
5
        {    
            
player_class[id] = Barbarian    
                    
        
}
        case 
6
        {    
            
player_class[id] = Ninja
            
        
}
        case 
7
        {    
            
player_class[id] = Demon_Hunter
            g_GrenadeTrap
[id] = 1
            
        
}    
        case 
8
        {    
            
player_class[id] = Pirate
            
            
        
}        
        
    }
    
client_print(id,print_chat,"[Diablo Mod] Type /classinfo to get more information about your class!")
    
    
LoadXP(idplayer_class[id])
    
CurWeapon(id)
    
    
give_knife(id)
    
//classmodels(id)    
    
return PLUGIN_HANDLED

This is the cvar:
PHP Code:
    register_cvar("diablo_classes""abcdefghi")
    
// a Mage
    // b Paladin
    // c Monk
    // d Assassin
    // e Barbarian
    // f Necromancer
    // g Ninja
    // h Demon Hunter
    // i Pirate 
When there is a letter missing in the diablo_classes it won't light up (stay dark / unpickable) when you wish to select a class.
If you need more details please ask for them.

Last edited by egbertjan; 10-01-2011 at 15:25.
egbertjan is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:25.


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