Failing to pick up loots.
#9

Quote:
Originally Posted by [WA]iRonan
Посмотреть сообщение
How does somebody pick up an object. And how does somebody enter his inventory?
None of that is coded in, as I mentioned this is just a scaffold script you need to write in your own functions for that but I'll do a quick example for you no problem.

pawn Код:
#define         PICKUP_RANGE            1.0

stock TryPickupItem(playerid)
{
    foreach(new i : ItemIndex)
    {
        if(IsPlayerInRangeOfPoint(playerid, PICKUP_RANGE, ItemData[index][gItemX], ItemData[index][gItemY], ItemData[index][gItemZ])) return i;
    }
    return INVALID_ITEM_ID;
}
This will return the index of first found item within range, most likely this would be called from OnPlayerKeyStateChange() if an item is found then you do your pickup code which would put it into your inventory then delete the item.

One more thing you should change Iter_Remove() to Iter_SafeRemove() in the delete function just in case your deleting items in a loop that uses foreach(new i : ItemIndex) { }
Reply


Messages In This Thread
Failing to pick up loots. - by [WA]iRonan - 18.12.2013, 13:45
Re: Failing to pick up loots. - by boomerboom - 18.12.2013, 14:19
Re: Failing to pick up loots. - by Pottus - 18.12.2013, 14:24
Re: Failing to pick up loots. - by [WA]iRonan - 18.12.2013, 14:41
Re: Failing to pick up loots. - by Pottus - 18.12.2013, 14:43
Re: Failing to pick up loots. - by [WA]iRonan - 18.12.2013, 14:55
Re: Failing to pick up loots. - by boomerboom - 18.12.2013, 14:57
Re: Failing to pick up loots. - by [WA]iRonan - 18.12.2013, 14:59
Re: Failing to pick up loots. - by Pottus - 18.12.2013, 15:11

Forum Jump:


Users browsing this thread: 2 Guest(s)