Invalid Expression, assumed zero?
#1

Not exactly sure why this is happening... Everything is correct..

pawn Код:
error 001: expected token: "]", but found "-identifier-"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
Functions.pwn(120) : fatal error 107: too many error messages on one line
pawn Код:
enum E_CHARACTER_INVENTORY
{
    itemModel,
    itemName[32],
    itemQuantity,
    itemData[248],
    bool: itemExists,
    bool: itemStackable,
}
new InventoryInformation[MAX_PLAYERS][MAX_INVENTORY_ITEMS][E_CHARACTER_INVENTORY];
pawn Код:
stock Inventory_Add(playerid, item[], model, bool:stackable, quantity = 1, data[])
{
    new slot = Inventory_HasItem(playerid, item);
    if(slot == -1)
    {
        slot = Inventory_GetFreeSlot(playerid);
        if(slot != -1)
        {
            InventoryInformation[playerid][slot][itemExists] = true;
            InventoryInformation[playerid][slot][itemStackable] = stackable;
            InventoryInformation[playerid][slot][itemModel] = model;
            InventoryInformation[playerid][slot][itemQuantity] = quantity;

                        // The issue is here
            format(InventoryInformation[playerid][slot][itemName], sizeof(InventoryInformation[playerid][slot][itemName]), "%s", item);
            format(InventoryInformation[playerid][slot][itemData], sizeof(InventoryInformation[playerid][slot][itemData]), "%s", data);
            return slot;
        }
        return -1;
    } else {

    }
    return slot;
}
Reply
#2

Код:
enum E_CHARACTER_INVENTORY
{
	itemModel,
	itemName[32],
	itemQuantity,
	itemData[248],
	bool: itemExists,
	bool: itemStackable 
}
new InventoryInformation[MAX_PLAYERS][MAX_INVENTORY_ITEMS][E_CHARACTER_INVENTORY];
I have atleast spotted this, you've put a comma on the last value in enum.
Reply
#3

Quote:
Originally Posted by Mike861
Посмотреть сообщение
Код:
enum E_CHARACTER_INVENTORY
{
	itemModel,
	itemName[32],
	itemQuantity,
	itemData[248],
	bool: itemExists,
	bool: itemStackable 
}
new InventoryInformation[MAX_PLAYERS][MAX_INVENTORY_ITEMS][E_CHARACTER_INVENTORY];
I have atleast spotted this, you've put a comma on the last value in enum.
I've fixed the issue, I failed to use " data[] = "" ", that was causing the issue including then throwing an AMX issue.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)