07.02.2010, 10:55
I have on problem with inventory...
And the command, when i buy something:
Now, when i buy ciggaretes, the array pInv[1][playerid][Item] should be equal to 1, and the when i type /inv it formats it to the info of the item, so, if =1 it should be "Ciggarets", and all i get is:
Empty slot
Empty slot
Empty slot
Empty slot
Empty slot
All 5 slots, are empty... Any ideas how to make inventory?
Код:
dcmd_inv(playerid,params[])
{
#pragma unused params
new Info[6][30];
new Items[128];
for(new i=1; i < 6; i++)
{
if(pInv[i][playerid][Item]==0) format(Info[i],30,"Empty slot");
if(pInv[i][playerid][Item]==1) format(Info[i],30,"Ciggarets");
format(Items,128,"%s\n%s\n%s\n%s\n%s",Info[i],Info[i],Info[i],Info[i],Info[i]);
}
ShowPlayerDialog(playerid,5,DIALOG_STYLE_LIST,"Player inventory",Items,"Ok","Close");
return 1;
}
Код:
...
if(listitem==0){
if(pInfo[playerid][Cash] < 10)return SendClientMessage(playerid,GREY,"Not enough money !");
PlayerPlaySound(playerid,1054,0,0,0);
pInfo[playerid][Cash] = pInfo[playerid][Cash] -10;
GivePlayerMoney(playerid,-10);
for(new a=1; a < 6; a++)
{
if(pInv[a][playerid][Item]==0) pInv[a][playerid][Item]=1;
return 0;
}
}
...
Empty slot
Empty slot
Empty slot
Empty slot
Empty slot
All 5 slots, are empty... Any ideas how to make inventory?

