Variable amount not showing in dialog.
#1

I'm adding stuff to my inventory system and upon opening the inventory I don't see the amount next to energy drinks. The amount should be at 0 like the rest. I did everything exactly the same way I did prior to this situation.

Is there a limit to how many variables you can show at once? If so, how do I work around this? Thanks.

pawn Код:
strcat(inventorystring, "Raw Fish: %d\n");
        strcat(inventorystring, "Empty Bottles: %d\n");
        strcat(inventorystring, "Filled Bottles: %d\n");
        strcat(inventorystring, "Materials: %d\n");
        strcat(inventorystring, "Logs: %d\n");
        strcat(inventorystring, "Cooked Fish: %d\n");
        strcat(inventorystring, "Proximity Bombs: %d\n");
        strcat(inventorystring, "Snares: %d\n");
        strcat(inventorystring, "Energy Drinks: %d");
        format(invstring,sizeof(invstring), inventorystring,fish[playerid], emptybottles[playerid], filledbottles[playerid], mats[playerid], logs[playerid], cookedfish[playerid], proximitybomb[playerid], snares[playerid], PlayerEnergyDrinks[playerid]);
        ShowPlayerDialog(playerid,INVENTORY_MAIN,DIALOG_STYLE_LIST, "Inventory", invstring, "Select", "Cancel");
Reply
#2

pawn Код:
new dialogstr[300];  //raise/lower the size if you need to.
//replace PlayerInfo[playerid][pFish] with all the appropiate values for each format. -> fish[playerid], emptybottles[playerid], filledbottles[playerid], mats[playerid], logs[playerid], cookedfish[playerid], proximitybomb[playerid], snares[playerid], PlayerEnergyDrinks[playerid]);
format(inventorystr,sizeof(inventorystr),"Raw Fish: %d\n",PlayerInfo[playerid][pFish]);
strcat(dialogstr,inventorystr);
format(inventorystr,sizeof(inventorystr),"Empty Bottles: %d\n",PlayerInfo[playerid][pFish]);
strcat(dialogstr,inventorystr);
format(inventorystr,sizeof(inventorystr),"Filled Bottles: %d\n",PlayerInfo[playerid][pFish]);
strcat(dialogstr,inventorystr);
format(inventorystr,sizeof(inventorystr),"Materials: %d\n",PlayerInfo[playerid][pFish]);
strcat(dialogstr,inventorystr);
format(inventorystr,sizeof(inventorystr),"Logs: %d\n",PlayerInfo[playerid][pFish]);
strcat(dialogstr,inventorystr);
format(inventorystr,sizeof(inventorystr),"Cooked Fish: %d\n",PlayerInfo[playerid][pFish]);
strcat(dialogstr,inventorystr);
format(inventorystr,sizeof(inventorystr),"Proximity Bombs: %d\n",PlayerInfo[playerid][pFish]);
strcat(dialogstr,inventorystr);
format(inventorystr,sizeof(inventorystr),"Snares: %d\n",PlayerInfo[playerid][pFish]);
strcat(dialogstr,inventorystr);
format(inventorystr,sizeof(inventorystr),"Energy Drinks: %d",PlayerInfo[playerid][pFish]);
strcat(dialogstr,inventorystr);
ShowPlayerDialog(playerid,INVENTORY_MAIN,DIALOG_STYLE_LIST, "Inventory", dialogstr, "Select", "Cancel");
Reply
#3

Thank you. But why wouldn't my way work?

EDIT: Major facepalm. Forgot to increase the string length of "invstring". Uhg, lol. Thanks for your help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)