Inventory saving [MySQL]
#2

1. DELETE FROM `inventory` WHERE `amount` = 0;

2. Check if the player has food by running a SELECT * FROM `inventory` WHERE `playername` = %s query, where %s is the player's name; store the result with mysql_store_result();; create a variable called result[MAX_AMOUNT_OF_ITEMS] (make sure to replace MAX_AMOUNT_OF_ITEMS) and then:

pawn Код:
while(mysql_retrieve_row())
    {
        mysql_fetch_field_row(result, "amount");  
        // Run this query: UPDATE `inventory` SET `itemid` = `food`, `amount` = %i; , where %i is the new value for the amount of X item.
    }
3. Just load the ones that aren't empty?
Reply


Messages In This Thread
Inventory saving [MySQL] - by GospodinX - 03.08.2018, 08:50
Re: Inventory saving [MySQL] - by GRiMMREAPER - 03.08.2018, 09:29
Re: Inventory saving [MySQL] - by GospodinX - 03.08.2018, 09:39
Re: Inventory saving [MySQL] - by GRiMMREAPER - 03.08.2018, 09:53
Re: Inventory saving [MySQL] - by Calisthenics - 03.08.2018, 13:10
Re: Inventory saving [MySQL] - by GospodinX - 03.08.2018, 14:47
Re: Inventory saving [MySQL] - by Calisthenics - 03.08.2018, 20:26

Forum Jump:


Users browsing this thread: 1 Guest(s)