18.01.2011, 03:20
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
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;
}