Order a list
#5

Quote:
Originally Posted by HidroDF
Посмотреть сообщение
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.
That's weird. Not sure if it will make any difference, but try:

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.
Reply


Messages In This Thread
Order a list - by HidroDF - 15.10.2016, 17:25
Re: Order a list - by SickAttack - 15.10.2016, 17:35
Respuesta: Re: Order a list - by Marricio - 15.10.2016, 17:40
Respuesta: Re: Order a list - by HidroDF - 15.10.2016, 18:12
Respuesta: Re: Order a list - by Marricio - 15.10.2016, 18:26
Respuesta: Order a list - by HidroDF - 15.10.2016, 18:29

Forum Jump:


Users browsing this thread: 1 Guest(s)