19.06.2018, 12:16
PHP код:
SaveInventory(playerid)
{
new _query[73];
mysql_format(handle, _query, sizeof(_query), "DELETE FROM `Inventory` WHERE `PlayerID` = %d", pInfo[playerid][pID]);
mysql_tquery(handle, _query);
for(new i; i<pInventory[playerid][iUsedSlots]; i++)
{
if(pInventory[playerid][iItemAmount][i] > 0)
{
mysql_format(handle, _query, sizeof(_query), "INSERT INTO `Inventory` VALUES (%d, %d, %d)", pInfo[playerid][pID], pInventory[playerid][iItems][i], pInventory[playerid][iItemAmount][i]);
mysql_tquery(handle, _query);
}
}
return 1;
}
As you can see, it makes another line, same id and the new item.
I wanted to change it work into this new database which have "PlayerId>Inv_1,_inv_2..., and so on up to Inv_50.
I want to change this query so every item the user picks up it will save to the next slot. Example a user pick up an item, it will save on "Inv_1", but if he picks up another item(doesn't matter if its the same or not) it should same to the next slot which is "Inv_2".
How do I do that? Thanks.