Drop System idea help - 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)
+--- Thread: Drop System idea help (
/showthread.php?tid=612574)
Drop System idea help -
VincenzoDrift - 19.07.2016
Hi, I made a basic drop system that works perfectly. Now I want a system that sets a maximum of dropped items (DEFINE MAX_DROP_ITEM 50). I wish that when an item is dropped halfway, the oldest item is deleted, so do remain a number of items on the server. Any of you have an idea on how to do it?
Re: Drop System idea help -
GuyB790 - 19.07.2016
Some pseudo-code of what I thought of:
Code:
#define MAX_DROPPED_ITEMS = 50
new lastDroppedItemIndex = 0
new droppedItems[MAX_DROPPED_ITEMS]
function DropItem(item) {
if lastDroppedItemIndex == 50 then
lastDroppedItemIndex = 0
droppedItems[lastDroppedItemIndex] = item
lastDroppedItemIndex++
}