15.10.2016, 17:25
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:
When I attach, for example, the item 2, the list shown is:
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
Now I have a list like:
Код:
1 - Colt 45 2 - Didlo 3 - AK47 4 - Empty .... 10 - Empty Equipped: Right hand: Nothing Left hand: Nothing
Код:
1 - Colt 45 2 - Empty 3 - AK47 .... 10 - Empty Equipped: Right hand: Dildo Left hand: Nothing
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); } }