Error 001 for new A1[20];
#1

I keep getting:
Quote:

error 001: expected token: "-identifier-", but found "-integer value-"

For this piece of code:
Код:
	new A1[20];
	if(PlayerInfo[targetid][pAmount1] == 1) { A1 = PlayerInfo[targetid][pWood]; }
    else if(PlayerInfo[targetid][pAmount1] == 2) { A1 = PlayerInfo[targetid][pFruit]; }
    else if(PlayerInfo[targetid][pAmount1] == 3) { A1 = PlayerInfo[targetid][pSeeds]; }
    else if(PlayerInfo[targetid][pAmount1] == 4) { A1 = PlayerInfo[targetid][pLeather]; }
    else if(PlayerInfo[targetid][pAmount1] == 5) { A1 = PlayerInfo[targetid][pHide]; }
    else if(PlayerInfo[targetid][pAmount1] == 6) { A1 = PlayerInfo[targetid][pMeat]; }
    else if(PlayerInfo[targetid][pAmount1] == 7) { A1 = PlayerInfo[targetid][pClothes]; }
    else if(PlayerInfo[targetid][pAmount1] == 8) { A1 = PlayerInfo[targetid][pCopper]; }
    else if(PlayerInfo[targetid][pAmount1] == 9) { A1 = PlayerInfo[targetid][pIron]; }
    else if(PlayerInfo[targetid][pAmount1] == 10) { A1 = PlayerInfo[targetid][pGold]; }
    else if(PlayerInfo[targetid][pAmount1] == 11) { A1 = PlayerInfo[targetid][pCoal]; }
    else if(PlayerInfo[targetid][pAmount1] == 12) { A1 = PlayerInfo[targetid][pCookedFish]; }
    else if(PlayerInfo[targetid][pAmount1] == 13) { A1 = PlayerInfo[targetid][pPerch]; }
    else if(PlayerInfo[targetid][pAmount1] == 14) { A1 = PlayerInfo[targetid][pSalmon]; }
    else if(PlayerInfo[targetid][pAmount1] == 15) { A1 = PlayerInfo[targetid][pTuna]; }
    else if(PlayerInfo[targetid][pAmount1] == 16) { A1 = PlayerInfo[targetid][pSwordfish]; }
    else if(PlayerInfo[targetid][pAmount1] == 17) { A1 = PlayerInfo[targetid][pWheat]; }
    else if(PlayerInfo[targetid][pAmount1] == 18) { A1 = PlayerInfo[targetid][pBread]; }
    else if(PlayerInfo[targetid][pAmount1] == 19) { A1 = PlayerInfo[targetid][pString]; }
    else if(PlayerInfo[targetid][pAmount1] == 20) { A1 = PlayerInfo[targetid][pArrow]; }
    else if(PlayerInfo[targetid][pAmount1] == 21) { A1 = PlayerInfo[targetid][pWater]; }
    else { A1 = "Nothing"; }
I'm trying to make a inventory system where if one slot is not filled it fills it, and each item has a specific amount. Any ideas how to fix this?
Reply
#2

Make the variable like that:

pawn Код:
new A1;
Reply
#3

Ah, never realised. Thanks, working now.
Reply
#4

Just to make that clear, your values were not a string, they were integer, as for strings, you can do what you done in the original code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)