SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/09/2016, 04:38 PM   #1
VincenzoDrift
Little Clucker
 
VincenzoDrift's Avatar
 
Join Date: Jun 2014
Posts: 47
Reputation: 3
Default Drop item loop idea

Hi I did a drop system that works perfectly... I want that when you reach the maximum number of drop, if it is still-dropped another item the older one disappears. A sort of infinite loop. Can you give me some idea how to make this? Or you can give me a link FilterScript that does this, so reading the code, I understand how to do it.
__________________
Sorry for my bad english
VincenzoDrift is offline   Reply With Quote
Old 10/09/2016, 04:46 PM   #2
DarkSkull
Huge Clucker
 
DarkSkull's Avatar
 
Join Date: Aug 2014
Location: Dubai, United Arab Emirates
Posts: 325
Reputation: 43
Default Re: Drop item loop idea

You can create an array sort of like this

PHP Code:
#define MAX_DROPS 100
new drops[MAX_DROPS
Then when you drop something, set change the drop value. And then loop thorough all of them. Then MAX_DROPS has reached, Then basically delete the first drop and put your drop in the first one.
DarkSkull is offline   Reply With Quote
Old 10/09/2016, 04:52 PM   #3
VincenzoDrift
Little Clucker
 
VincenzoDrift's Avatar
 
Join Date: Jun 2014
Posts: 47
Reputation: 3
Default Re: Drop item loop idea

I have thought about this, only that others must climb. Then the second drop becomes the third, the third drop becomes the fourth, etc ..
__________________
Sorry for my bad english
VincenzoDrift is offline   Reply With Quote
Old 10/09/2016, 05:06 PM   #4
SickAttack
High-roller
 
Join Date: Dec 2013
Posts: 4,761
Reputation: 754
Default Re: Drop item loop idea

Why is there a drop limit, though?
SickAttack is offline   Reply With Quote
Old 10/09/2016, 05:06 PM   #5
VincenzoDrift
Little Clucker
 
VincenzoDrift's Avatar
 
Join Date: Jun 2014
Posts: 47
Reputation: 3
Default Re: Drop item loop idea

Because I don't want 500000 drop on my server. Too lag...
__________________
Sorry for my bad english
VincenzoDrift is offline   Reply With Quote
Old 10/09/2016, 05:09 PM   #6
SickAttack
High-roller
 
Join Date: Dec 2013
Posts: 4,761
Reputation: 754
Default Re: Drop item loop idea

Edit: Nevermind, I thought it was going to be for per player. But it's global.

What you can do is add a count, when it reaches the last ID, put all the items one index down and at the last index add the new item.

Last edited by SickAttack; 10/09/2016 at 05:46 PM.
SickAttack is offline   Reply With Quote
Old 10/09/2016, 05:16 PM   #7
n0minal
High-roller
 
n0minal's Avatar
 
Join Date: Mar 2013
Location: Rio de Janeiro
Posts: 4,046
Reputation: 789
Default Re: Drop item loop idea

That's fully programming logic, you need to visualize in your mind how your algorithm needs to behave, so you can just code your system based on it. You need to loop, use the logic to detect which item you want to replace. I don't know if it will help you but I made an advanced drop system for my old gamemode, which is released for free on my github account, you can just check it here (drop rate system) and here the main inventory file, there are also other archives, but it's a bit complex to understand, that's not exactly what you're searching for but it can help you in any way.
n0minal is offline   Reply With Quote
Old 10/09/2016, 10:40 PM   #8
venomlivno8
Big Clucker
 
Join Date: Jan 2013
Posts: 97
Reputation: 5
Default Re: Drop item loop idea

for(new i = E_MAX_DROPS; i > 0; i--) {
E_DROPPED_ITEM[i+1] = E_DROPPED_ITEM[i];
}

E_DROPPED_ITEM[0] = droppeditem;
venomlivno8 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Drop System idea help VincenzoDrift Scripting Help 1 19/07/2016 03:05 PM
Drop item[HELP!!!] Supermaxultraswag Scripting Help 1 18/08/2014 09:44 AM
[HELP] Loop problem (Weapon Drop) eDz0r Scripting Help 10 26/11/2011 10:44 AM


All times are GMT. The time now is 03:40 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.