03.06.2014, 13:38
Enums do save strings aslong as you define the string size.
Also, your array wouldn't work since you didn't define a playerid. You also won't really need to store the item name in your enum as you should be able to retrieve it from the array.
This is taken from my own inventory system, hopefully you can get the idea of what I'm trying to say:
The item array:
Storing them using these defines and variables:
Retrieving the name from the array, this would work (please note: pInv_Item is actually the player's inventory, I will emphasize inside the [pawn] code:
EDIT: Thanks Eth (:
Also, your array wouldn't work since you didn't define a playerid. You also won't really need to store the item name in your enum as you should be able to retrieve it from the array.
This is taken from my own inventory system, hopefully you can get the idea of what I'm trying to say:
The item array:
pawn Код:
new InventoryItems[MAX_INV_ITEMS][][] = {
// ID Name of Item Obj ID
{0, "Untied Rope", 964},
{1, "Wood Blocks", 1463},
{2, "Hunting Knife", 335}
};
pawn Код:
#define MAX_INV_SLOTS 5
// Store item ID inside of this
new pInv_Item[MAX_PLAYERS][MAX_INV_SLOTS];
new pInv_Value[MAX_PLAYERS][MAX_INV_SLOTS];
pawn Код:
for(new i = 0; i < MAX_INV_SLOTS; i ++)
{
InventoryItems[ pInv_Item[playerid][i] ][1][0]
}
// To explain the following; "i" equals the player's inventory slot: which saves the item ID -- empty slots are "0", that's how you find them.
pInv_Item[playerid][i]