10.06.2014, 19:41
Hello.
I'm creating a custom class selection and with my quite beginner experience I faced another problem during the day. I'm trying to list skins from array which I already achieved by some little help around the forums today, however another problem occurred.
Here is the current array I've been working on.
What I'm trying to do is actually like a small "binary tree". What I mean by this is that for example if you press shift in class ID 1, you will be forced to choose skins that are only related to class ID 1.
In my code above, there are all the "main classes" and the "tree of the first class only which is id 0. Alright, till here everything works fine.
What I was trying to make is so if I select ID: 0, then I can only switch between ID 7 and 12 and cannot switch the main ID's which are in case from 0 to 6.
Is there any possible way to do that?
EDIT:
A little idea came to my mind. I created a simple function which knows which skins are related to main class.
Dunno if it could get any useful.
I'm creating a custom class selection and with my quite beginner experience I faced another problem during the day. I'm trying to list skins from array which I already achieved by some little help around the forums today, however another problem occurred.
Here is the current array I've been working on.
pawn Код:
enum e_CLASS_DATA
{
e_CLASS_ID,
e_CLASS_SKIN,
e_CLASS_TEAM,
e_CLASS_INTERIOR,
Float:e_CLASS_POS[4]
};
new const cData[MAX_CLASSES][e_CLASS_DATA] =
{
// Main Classes
{0, 271, 0, 7, {766.6708, -68.6765, 1001.5692, 270.0}},
{1, 102, 1, 7, {766.6708, -68.6765, 1001.5692, 270.0}},
{2, 115, 2, 7, {766.6708, -68.6765, 1001.5692, 270.0}},
{3, 109, 3, 7, {766.6708, -68.6765, 1001.5692, 270.0}},
{4, 100, 4, 7, {766.6708, -68.6765, 1001.5692, 270.0}},
{5, 280, 5, 7, {766.6708, -68.6765, 1001.5692, 270.0}},
{6, 2, 6, 7, {766.6708, -68.6765, 1001.5692, 270.0}},
//Tree of skins only for the first class which is in case id 0 above
{7, 271, 0, 3, {2496.0537, -1693.6073, 1014.7422, 180.6}},
{8, 105, 0, 3, {2496.0537, -1693.6073, 1014.7422, 180.6}},
{9, 106, 0, 3, {2496.0537, -1693.6073, 1014.7422, 180.6}},
{10, 107, 0, 3, {2496.0537, -1693.6073, 1014.7422, 180.6}},
{11, 269, 0, 3, {2496.0537, -1693.6073, 1014.7422, 180.6}},
{12, 270, 0, 3, {2496.0537, -1693.6073, 1014.7422, 180.6}}
};
In my code above, there are all the "main classes" and the "tree of the first class only which is id 0. Alright, till here everything works fine.
What I was trying to make is so if I select ID: 0, then I can only switch between ID 7 and 12 and cannot switch the main ID's which are in case from 0 to 6.
Is there any possible way to do that?
EDIT:
A little idea came to my mind. I created a simple function which knows which skins are related to main class.
pawn Код:
stock name(playerid)
{
for (new i = 0; i < MAX_CLASSES; i++)
{
if (pData[playerid][P_CLASS_REAL_ID] == cData[i][e_CLASS_TEAM])
{
printf("%d", i);
}
}
}