Need an idea for this.
#1

This is probably the dumbest thing I have done/faced but I am out of idea now. I noticed that my gamemode size was 4,997 KB (around 4.88MB).

So, I searched around the code for a while to see which array is taking up way too much data and found the player vehicles iterator;

PHP код:
new Iterator:PlayerVehicles[MAX_HOUSES]<MAX_VEHICLES>; 
MAX_HOUSES is defined 1000 and MAX_VEHICLES is 2000 as default. I haven't undefined MAX_VEHICLES yet so that's why it's happening (I guess). When I remove this and compile, the gamemode size drops by 2MB and that's a huge change. I am out of idea on what else should I do to improve this as my current vehicle ownership works fine as well but I can't be bothered wasting 2MB of space if there is a way around to solve this.

Before, I had an array size of 12 (maximum vehicles a player can own) and I would grab a free slot in this array and store the vehicle ID there as well as grabbing a free iterator slot and adding it there, I kind of felt like it was not the proper way of using foreach iteration. I am still newbie at working with foreach.

The vehicle system worked that way as well but there were few bugs that caused players to randomly lose their vehicles and also confused me with the slots and such so I created a direct iterator as I showed above not realizing that it's taking huge amount of data.

Any help to improve this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)