19.06.2011, 12:07
What does vector_find return if the given element is not found?
My code:
If I set itemid to something that already exists('15' on index 0), it returns it's index properly.

If I set it to something that doesn't exist (188) it returns index 1, which is set to zero.
My code:
pawn Код:
stock GiveItem(playerid, itemid, amount = 1)
{
new slot = vector_find(VectorID(playerid, ITEM_VECTOR_ID), itemid);
FMSG(playerid, COL_ACTION, "PID:%d ITEMID:%d AMOUNT:%d || SLOT:%d SLOTITEM:%d", playerid, itemid, amount, slot, vector_get(VectorID(playerid, ITEM_VECTOR_ID), slot));

If I set it to something that doesn't exist (188) it returns index 1, which is set to zero.
