04.12.2009, 00:42
Код:
enum pInfo { pStrKey[128], pIntLevel, pIntSex }; new PlayerInfo[MAX_PLAYERS][pInfo];
Код:
PlayerInfo[playerid][1]
Thanks for your time.
enum pInfo { pStrKey[128], pIntLevel, pIntSex }; new PlayerInfo[MAX_PLAYERS][pInfo];
PlayerInfo[playerid][1]
enum info
{
pAdmin,
pCash,
pBackPack,
}
new PlayerInfo[MAX_PLAYERS][info];
new pItemNames[MAX_PLAYERS][MAX_ITEMS][MAX_ITEM_NAME];
new pItemAmounts[MAX_PLAYERS][MAX_ITEMS]
new pInfoIndex[][] = { "pStrKey", "pIntLevel" "pIntSex" };
PlayerInfo[playerid][pInfoIndex[i]]
enum //no name
{
pStrKey[128],
pIntLevel,
pIntSex
}
new PlayerInfo[MAX_PLAYERS][130]; //size of the total array, 128 chars + 2 integers = 130
//usage
PlayerInfo[0] = "some string here";
PlayerInfo[0][ 128 ] = 33;
PlayerInfo[0][ 129 ] = 4444444;
printf("%s,%d,%d", PlayerInfo[0], PlayerInfo[0][128], PlayerInfo[0][129]);
some string here,33,4444444 |
Originally Posted by Pload
Thanks for the reply Donny.
Unfortunately your code really doesn't do the tricks needed. Using just numbers to define the arrays works to an extent but it also removes the ability to store strings within those arrays as far as I know. It also becomes confusing for calling values later on in programming. I would need to call "3" instead of "pIntSex" which is easy enough with the small amount of variables currently there but once there is over 20, I'm not going to be able to easily tell what variable I'm calling at all. |
enum
{
pStrKey[128]
pIntLevel,
pIntSex
}
enum
{
pIntLevel_IDX = 128, //pStrKey size (0 - 127)
pIntSex_IDX //129
}
PlayerInfo[0][pIntSex_IDX] = .... //pIntSex_ID is 129, 129 is pIntSex in the array slots, based on my above example