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 , 5 , szName , 63 , callback);
new i = 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 1: pInfo[id][Class] = Dog
case 2: pInfo[id][Class] = Bear
case 3: pInfo[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