Changing slot ID? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Changing slot ID? (
/showthread.php?tid=212846)
Changing slot ID? -
Antonio [G-RP] - 18.01.2011
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;
}
Re: Changing slot ID? -
hoodline - 18.01.2011
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] ++;
}
Re: Changing slot ID? -
Antonio [G-RP] - 18.01.2011
Thanks for the reply. I'm just gonna screw around with this stuff, so I'll figure it out sooner or later.