Changing slot ID?
#1

I have a code here, and what I want it to do is every time it loads an item for the player, it switches the slot so that it doesn't load the items into the same slot.

Extra Info:

#define MAX_ITEMSLOTS 10

pawn Код:
public LoadPlayerItems(playerid)
{
    new resultline[1024], query[128];
   
    printf("Loading PlayerItems to playerid %d", playerid);
   
    format(query, sizeof(query), "SELECT `itemid`, `ownerid`, `value` FROM `player_items` WHERE `ownerid` = %d", PlayerInfo[playerid][pSQLid]);
    mysql_query(query);
    mysql_store_result();
   
    new slotid[MAX_ITEMSLOTS];

    while(mysql_fetch_row(resultline)==1)
    {
        printf("%s", resultline);
       
        new id, owner, value;
        if(!sscanf(resultline, "p<|>ddd", id, owner, value))
        {
            PlayerItemsInfo[playerid][slotid][piItemID] = id;
            PlayerItemsInfo[playerid][slotid][piOwnerID] = owner;
            PlayerItemsInfo[playerid][slotid][piValue] = value;
        }
        else
        {
            print("Error: There was a problem parsing playeritems data! Moving to next result.");
        }
    }
    mysql_free_result();
    return 1;
}
Reply
#2

Do you mean a for loop if not please explain more i dont know what you mean

Код:
for( new curslot = 0; curslot < MAX_SLOTS; curslot ++)
{
    slotid[curslot] ++; 
}
Reply
#3

Thanks for the reply. I'm just gonna screw around with this stuff, so I'll figure it out sooner or later.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)