Quote:
Originally Posted by alongub
Can you paste your code?
And what version are you using?
|
Using Store 1.1
Code:
//TestFunc gets all the items from the database with the only filter being that the items are
//buyable. It then passes it to the GetItemsCallback.
TestFunc(client)
{
new Handle:pack = CreateDataPack();
WritePackCell(pack, GetClientSerial(client));
new Handle:filter = CreateTrie();
SetTrieValue(filter, "is_buyable", 1);
Store_GetItems(filter, GetItemsCallback, false, pack);
}
//The callback picks a random item from the returned array of ids, and gives it to the client
//retrieved from the serial.
public GetItemsCallback(ids[], count, any:pack)
{
ResetPack(pack);
new serial = ReadPackCell(pack);
CloseHandle(pack);
new client = GetClientFromSerial(serial);
if (client == 0)
return;
new id = Math_GetRandomInt(0, count);
PrintToConsole(client, "Count: %i", count);
PrintToConsole(client, "Item ID chosen: %i (Index: %i)", ids[id], id);
decl String:itemName[128];
decl String:itemType[128];
//Occasionally (about 50% of the time) it will get this far, and then throw the error posted in
//the OP. There doesn't seem to be any rhyme or reason as to the items themselves, I
//checked the ID's, and they vary anywhere inbetween 1 and 600. The names also don't
//seem to have any cause in the error, the errors occur with all different types of names
//(short ones, long ones, ones with/without spaces)
Store_GetItemDisplayName(id, itemName, sizeof(itemName));
Store_GetItemType(id, itemType, sizeof(itemType));
PrintToConsole(client, "Name: %s", itemName);
PrintToConsole(client, "Type: %s", itemType);
new accountId = Store_GetClientAccountID(client);
Store_GiveItem(accountId, id, Store_Unknown);
}
__________________