Raised This Month: $ Target: $400
 0% 

XP Mod, setting lvls, exp, saving


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
t3hNox
Senior Member
Join Date: Oct 2009
Old 08-06-2010 , 05:40   XP Mod, setting lvls, exp, saving
Reply With Quote #1

Hi,
I had already posted for help in XP Mod tutorial topic but I didn't succeed to get enough help.

So I want to modify the code from XP Mod (original code here) so that every class would have individual levels and experience.
wrecked_ gave me code for starting:
PHP Code:
enum Class
{
    
Dog,
    
Bear,
    
Cat
}

enum Data
{
    
Level,
    
EXP
}

new 
pInfo[33][Class][Data]

// pInfo now holds each class and the player's Level+EXP with each

// pInfo[id][Bear][Level] = Level of the player when his class is Bear
// pInfo[id][Cat][EXP] = EXP of the player when his class is Cat 
I don't really understand how multidimensional arrays and enum work in this case so there are few things I'd like to ask.

Storing player's level and experience in a variable for saving in nvault would look like this ?
PHP Code:
new pCatLevel[33], pCatEXP[33]
pInfo[id][Cat][Level] = pCatLevel[id]
pInfo[id][Cat][EXP] = pCatEXP[id
I don't know how to assign pInfo[33][Class][Data] Class value. Umm.. pInfo[id][Class] = Cat ?
I'm trying this:
PHP Code:
public Class_Handle(id menu item
{
    if(
item == MENU_EXIT
    {
 
        
menu_destroy(menu);
 
    }
 
    new 
szCommand[6] , szName[64];
    new 
access callback;
 
    
menu_item_getinfo(menu item access szCommand szName 63 callback);
 
    new 
str_to_num(szCommand)
    if(
PlayerClass[id] != i)
    {
        
PlayerClass[id] = i
        client_print
(id,print_chat,"You have selected %s class.",CLASSES[i])
        
                
//Look here below.
        
switch(i)
        {
            case 
1pInfo[id][Class] = Dog
            
case 2pInfo[id][Class] = Bear 
            
case 3pInfo[id][Class] = Cat
        
}
    }
    else
    {
        
client_print(id,print_chat,"You are alredy a %s.",CLASSES[i])
    }
 
    
menu_destroy(menu);
    return 
PLUGIN_CONTINUE

I need to figure out these things
t3hNox 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 00:06.


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