new coordsstring[900]; new title[900]; switch(AccountInfo[playerid][pChips]) { case 0: return 0; default: format(coordsstring, sizeof coordsstring, "%s%d\tChips\n",coordsstring,chips); } switch(AccountInfo[playerid][pToolKit]) { case 0: return 0; default: format(coordsstring, sizeof coordsstring, "%s%d\tTool Kits\n",coordsstring,kit); } switch(AccountInfo[playerid][pWaterBottle]) { case 0: return 0; default: format(coordsstring, sizeof coordsstring, "%s%d\tWater Bottles\n",coordsstring,waterbottle); } switch(AccountInfo[playerid][pBeef]) { case 0: return 0; default: format(coordsstring, sizeof coordsstring, "%s%d\tBeef\n",coordsstring,Beef); } switch(AccountInfo[playerid][pWater]) { case 0: return 0; default: format(coordsstring, sizeof coordsstring, "%s%d\tWater\n",coordsstring,water); } switch(AccountInfo[playerid][pSoda]) { case 0: return 0; default: format(coordsstring, sizeof coordsstring, "%s%d\tSoda\n",coordsstring,Soda); } switch(AccountInfo[playerid][pMatches]) { case 0: return 0; default: format(coordsstring, sizeof coordsstring, "%s%d\tMatches\n",coordsstring,matches); } switch(AccountInfo[playerid][pWood]) { case 0: return 0; default: format(coordsstring, sizeof coordsstring, "%s%d\tWood\n",coordsstring,wood); } switch(AccountInfo[playerid][pMetal]) { case 0: return 0; default: format(coordsstring, sizeof coordsstring, "%s%d\tMetal\n",coordsstring,metal); } switch(AccountInfo[playerid][pBeefDone]) { case 0: return 0; default: format(coordsstring, sizeof coordsstring, "%s%d\tBeef Cooked\n",coordsstring,cookedBeef); } switch(AccountInfo[playerid][pChips] + AccountInfo[playerid][pToolKit] + AccountInfo[playerid][pWaterBottle]) { case 0: format(coordsstring,sizeof(coordsstring),"Empty Backpack"); } format(title, sizeof title, "{9ACD32}Current Backpack{FFFFFF} [%d/%d]",slotsfree,slots); ShowPlayerDialog(playerid, BACKPACK, DIALOG_STYLE_LIST, title, coordsstring, "Select", "Close");
if(AccountInfo[playerid][pChips]) format(coordsstring, sizeof coordsstring, "%s%d\tChips\n",coordsstring,chips);
if(AccountInfo[playerid][pToolKit]) format(coordsstring, sizeof coordsstring, "%s%d\tTool Kits\n",coordsstring,kit);
if(AccountInfo[playerid][pWaterBottle]) format(coordsstring, sizeof coordsstring, "%s%d\tWater Bottles\n",coordsstring,waterbottle);
This is some really weird coding..... Of course it will fail because of the return 0; on all the switch() statements as soon as one of those is not 0 then it will do the format but they would all have to be something other than 0 and in that case it will work. To be honest this coding is completely out to lunch. Avoid using multiple return; statements only use them when needed which should almost never be more than two per function. The use of switch() here is a bad choice as well use if statements.
pawn Код:
|