help !!
#1

Guys... could you help me? i really don't get..

Код:
CMD:inventory(playerid,params[])
{
	new choice[20][3],InvNum;
	new string[400],StrSlot1[50],StrSlot2[50];
	if(PlayerInfo[playerid][Slot1] == EMPTYSLOT)
	{
		format(StrSlot1,sizeof(StrSlot1),"- Empty Slot -");
	}
	if(PlayerInfo[playerid][Slot1] == HEALTHYFRUIT)
	{
		format(StrSlot1,sizeof(StrSlot1),"Healthy fruit");
	}
	if(PlayerInfo[playerid][Slot1] == NACHO)
	{
		format(StrSlot1,sizeof(StrSlot1),"Nacho\t");
	}
	if(PlayerInfo[playerid][Slot2] == EMPTYSLOT)
	{
		format(StrSlot2,sizeof(StrSlot2),"- Empty Slot -");
	}
	if(PlayerInfo[playerid][Slot2] == HEALTHYFRUIT)
	{
		format(StrSlot2,sizeof(StrSlot2),"Healthy fruit");
	}
	if(PlayerInfo[playerid][Slot2] == NACHO)
	{
		format(StrSlot2,sizeof(StrSlot2),"Nacho\t");
	}
	
	if(sscanf(params,"si",choice,InvNum))
	{
   		SendClientMessage(playerid,GRAD2,"* Inventory [Choice] [Inventory Number] *");
	    SendClientMessage(playerid,GRAD2,"* Choice: Use, Give, Drop. *");
		format(string,sizeof(string),"*Item: [1 %s (%d)]\t[2 %s (%d)] *",StrSlot1,PlayerInfo[playerid][SlotQty1],StrSlot2,PlayerInfo[playerid][SlotQty2]);
		SendClientMessage(playerid,GRAD2,string);
		if(choice == "Use")
		{
		}
		return 1;
	}
	return 1;
}
this line here:
Код:
if(choice == "Use")
it says array must be indexed.. and i dont know how to use arrays.
Reply
#2

pawn Код:
CMD:inventory(playerid,params[])
{
    new choice[20][3],InvNum;
    new string[400],StrSlot1[50],StrSlot2[50];
    if(PlayerInfo[playerid][Slot1] == EMPTYSLOT)
    {
        format(StrSlot1,sizeof(StrSlot1),"- Empty Slot -");
    }
    if(PlayerInfo[playerid][Slot1] == HEALTHYFRUIT)
    {
        format(StrSlot1,sizeof(StrSlot1),"Healthy fruit");
    }
    if(PlayerInfo[playerid][Slot1] == NACHO)
    {
        format(StrSlot1,sizeof(StrSlot1),"Nacho\t");
    }
    if(PlayerInfo[playerid][Slot2] == EMPTYSLOT)
    {
        format(StrSlot2,sizeof(StrSlot2),"- Empty Slot -");
    }
    if(PlayerInfo[playerid][Slot2] == HEALTHYFRUIT)
    {
        format(StrSlot2,sizeof(StrSlot2),"Healthy fruit");
    }
    if(PlayerInfo[playerid][Slot2] == NACHO)
    {
        format(StrSlot2,sizeof(StrSlot2),"Nacho\t");
    }
   
    if(sscanf(params,"si",choice,InvNum))
    {
        SendClientMessage(playerid,GRAD2,"* Inventory [Choice] [Inventory Number] *");
        SendClientMessage(playerid,GRAD2,"* Choice: Use, Give, Drop. *");
        format(string,sizeof(string),"*Item: [1 %s (%d)]\t[2 %s (%d)] *",StrSlot1,PlayerInfo[playerid][SlotQty1],StrSlot2,PlayerInfo[playerid][SlotQty2]);
        SendClientMessage(playerid,GRAD2,string);
        if(strcmp(choice, "use", true) == 0)
        {
        }
        return 1;
    }
    return 1;
}
Reply
#3

pawn Код:
CMD:inventory(playerid,params[])
{
    new choice[20][3],InvNum;
    new string[400],StrSlot1[50],StrSlot2[50];
    if(PlayerInfo[playerid][Slot1] == EMPTYSLOT)
    {
        format(StrSlot1,sizeof(StrSlot1),"- Empty Slot -");
    }
    if(PlayerInfo[playerid][Slot1] == HEALTHYFRUIT)
    {
        format(StrSlot1,sizeof(StrSlot1),"Healthy fruit");
    }
    if(PlayerInfo[playerid][Slot1] == NACHO)
    {
        format(StrSlot1,sizeof(StrSlot1),"Nacho\t");
    }
    if(PlayerInfo[playerid][Slot2] == EMPTYSLOT)
    {
        format(StrSlot2,sizeof(StrSlot2),"- Empty Slot -");
    }
    if(PlayerInfo[playerid][Slot2] == HEALTHYFRUIT)
    {
        format(StrSlot2,sizeof(StrSlot2),"Healthy fruit");
    }
    if(PlayerInfo[playerid][Slot2] == NACHO)
    {
        format(StrSlot2,sizeof(StrSlot2),"Nacho\t");
    }
   
    if(sscanf(params,"s[20]i",choice,InvNum))
    {
        SendClientMessage(playerid,GRAD2,"* Inventory [Choice] [Inventory Number] *");
        SendClientMessage(playerid,GRAD2,"* Choice: Use, Give, Drop. *");
        format(string,sizeof(string),"*Item: [1 %s (%d)]\t[2 %s (%d)] *",StrSlot1,PlayerInfo[playerid][SlotQty1],StrSlot2,PlayerInfo[playerid][SlotQty2]);
        SendClientMessage(playerid,GRAD2,string);
        if(strcmp(choice, "use", true) == 0)
        {
        }
        return 1;
    }
    return 1;
}
eric that code you gave will not work you forget to do this
pawn Код:
if(sscanf(params"s[20]i"))
Reply
#4

ow..

Код:
if(strcmp(choice, "use", true) == 0)
array dimensions doesnt much :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)