Order a list
#1

Hello. I'm making an Inventory system. I have a command (/inv) that shows a list dialog with your items. You can attach items and save the item again to your inventory. What I want is order the list when a Object is attached.

Now I have a list like:

Код:
1 - Colt 45
2 - Didlo
3 - AK47
4 - Empty
....
10 - Empty
Equipped:
Right hand: Nothing
Left hand: Nothing
When I attach, for example, the item 2, the list shown is:

Код:
1 - Colt 45
2 - Empty
3 - AK47
....
10 - Empty
Equipped:
Right hand: Dildo
Left hand: Nothing
It's logic because in the for loop, the variable is equipped so, the 2 item is empty. But I don't want to show an empty space and then a Item, I want to show everything sorted. First the objects then empty spaces.

This is how I do the list
Код:
for(new i = 0; i < 10; i++)
	{
	    if(pItems[playerid][iID][i] > 0 && pItems[playerid][iUsed][i] == 0)
	    {
    		slot += 1;
  	 	  	format(string,sizeof(string), "%s[%i]\t%s\t[%i]\n", string, slot, NObject(pItems[playerid][iType][i]), pItems[playerid][iAmmo][i]);
   		}
   		else
   		{
   		    slot += 1;
   		    format(string,sizeof(string), "%s[%i]\tEmpty space\n", string, slot);
   		}
	}
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: 3 Guest(s)