Raised This Month: $ Target: $400
 0% 

[Help] Merging old and new menu script


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 10-02-2011 , 10:21   [Help] Merging old and new menu script
Reply With Quote #1

Hello,

I wanted to merge the old and the new menu used to select my class, but I kinda failed doing so.
The old script looks like this:
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

And the new one will look something like this:

PHP Code:
public select_class(id,lx)
{
    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);

There are 2 important things for me.
1) When the menu comes up I want to see the level the class is (Mage Level: xx
2) Currently the menu is based on cvars, when certain cvars are disabled that means that the class is also disabled.

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 
And the select menu:
PHP Code:
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)
    return 
PLUGIN_HANDLED

Thanks in advance.
egbertjan is offline
 



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 19:39.


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