03.08.2018, 08:50
Hi guys,
I have few question about Inventory Saving.I want to make that player can save some items in bag.
I will create table 'inventory'
Now i don't know how:
1) How to delete row if amount is 0(Or I need to check every time is amount empty and then delete?) Or there is way that all rows where amount = 0 need to be deleted?
2) How to "save" new item in inventroy.For example :
-If player already have food,I need just update row(where itemid = food)
-But if player don't have food,I need to insert new row.
So how to do it?Or i need every time check it?
3) What is best way to load it on server?
If i have 10 items,do this:
new item[10][MAX_PLAYERS] and then load or there is better way?(because players dont will have every time all items,so..There will be many times empty variables,i don't know is there better way.
Thanks
(sorry for my poorly english)
I have few question about Inventory Saving.I want to make that player can save some items in bag.
I will create table 'inventory'
Quote:
userid, itemid, amount |
1) How to delete row if amount is 0(Or I need to check every time is amount empty and then delete?) Or there is way that all rows where amount = 0 need to be deleted?
2) How to "save" new item in inventroy.For example :
-If player already have food,I need just update row(where itemid = food)
-But if player don't have food,I need to insert new row.
So how to do it?Or i need every time check it?
3) What is best way to load it on server?
If i have 10 items,do this:
new item[10][MAX_PLAYERS] and then load or there is better way?(because players dont will have every time all items,so..There will be many times empty variables,i don't know is there better way.
Thanks
(sorry for my poorly english)