15.10.2016, 18:26
Quote:
Thanks, but there's a problem.
When the player has no items, show 10 slots. When the player has 1 item it shows 9 slots (1 occuped 8 empty), if 2, shows 8 slots, etc. |
pawn Код:
new count;
for(new i; i < 10; i ++)
{
if(pItems[playerid][iID][i] > 0 && pItems[playerid][iUsed][i] == 0)
{
count ++;
format(string, sizeof(string), "%s[%i]\t%s\t[%i]\n", string, count, NObject(pItems[playerid][iType][i]), pItems[playerid][iAmmo][i]);
}
}
if(count < 10)
{
for(new i = count; i < 10; i++)
{
count++;
format(string, sizeof(string), "%s[%i]\tEmpty space\n", string, count);
}
}
EDIT: Figured out why, while we're increasing the count variable value we're also passing it as reference during the loop, that's why we're getting less repetitions.