TrafficLoad
03-10-2011 (3 october that is)

This is a simple traffic loading fix, for people who have modded cars and get the issue of always the same car appearing. It is also a welcome addition for people who wish to have more diverse traffic and/or want more control of the amount of traffic appearing.


#Installation
You will need an asi loader and aru's Scripthook, or something similar. Be sure you GTA IV can load .asi scripts. This script has been tested on 1.0.3.0 (with ScriptHook 0.4.0), 1.0.4.0 (ScriptHook 0.4.0) and 1.0.7.0 (with ScriptHook 0.5.1).
To install this mod, copy the files TrafficLoad.asi and TrafficLoad.ini in your GTA IV folder. Remove all older or other versions!

#TrafficLoad.ini configuration
You can specify your own values for both pedestrians and cars in the .ini. It is also possible to modify the amount of cars loaded before models that aren't used anymore are wiped from memory.

#Extra cars
When you have no added cars installed, no modification is needed. If you do have added cars, look in the .ini for clarification. Up to 15 cars can be added.

#Trouble?
If the mod does not load, check ScriptHook.log for possible messages, or the lack thereof. If nothing is loaded, be sure to right click the file and check for any security measurements Windows Vista and Windows 7 apply. Remove those, they prevent the file from getting loaded.
When it still doesn't load or it loads but a weird memory address pops up in the logs, copy and paste MSVCR100D.dll into your GTA IV folder. (Thanks to BehelitOutlaw for finding that)
Or download it here: http://www.dll-files.com/dllindex/dll-files.shtml?msvcr100d

If you experience crashes and/or texture loading trouble, you might try to lower the amount of cars per cycle.


#How this mod works and further things you maybe would like to know
This fix randomly loads any car into the memory. After [the amount you specified] car models are loaded it tells the game to mark ALL cars as unneeded if they exist. This causes the game to unload any cars which aren't on screen anymore. After that, it randomly loads 26 cars again. This process repeats the entire time the game is loaded. Each cycle takes roughly [the amount you specified] seconds, but you won't notice anything. Just give the script some time to load, [the amount you specified]*2.5 seconds after loading a savegame, traffic diversity is constant.
Busses and taxis however do not participate in the cycle. They always load no matter what has been chosen, they just load. Busses appear regulary and all taxi variants appear in a good mixture.
This way of loading offers far more diversity than older methods. Cars which aren't loaded normally appear in traffic. Sports cars load sparingly, but they all load. Even the Infernus and Comet load. You won't notice repeating cycles anymore consisting of 30 different cars, all 84 cars (excluding service cars and taxis) are loaded. Bikes also appear normally since 03-10-2011.


Have fun!
- ikt

If problems occur, please reply in this thread:
http://www.gtaforums.com/index.php?showtopic=481572
or reply in the download page of this mod on GTA4-mods.com


You may freely host, rehost or distribute this mod. If you plan to host the mod, please leave this package as it is. The same thing applies when including this fix in your mod, leave this package as it is. Thank you!



##########
Disregard ALL old versions. They are unstable and caused a lot of irritations.
##########










##########
Description for old versions that did crash the game eventually or mess up the performance:

trafficloadv1.asi
This version causes crashes if your system specifications aren't sufficient. Use this version only if you are sure you have plenty of RAM (even that is not sure, I haven't been able to test it on a rig with more than 4GB RAM. Report back if yours doesn't crash in either the GTA4-mods.com page or my GTAForums thread). Otherwise it will crash certainly after a small amount of time (4GB RAM  within 15 minutes) (less than 5 minutes have been reported with 3GB RAM).
However, people using Gamebooster reported no crashes, you might try that in combination with this version (1).


trafficloadv2.asi
This version should work pretty well. It checks if a pool has been loaded, if so, it will not load and choose another pool. Should prevent double loading. Traffic diversity is a bit less than the first version, but it still occasionally loads busses, fast cars and shitty cars.

trafficloadv3.asi
Now, hopefully, the final version. I discovered that GTA IV could handle about 45 loaded vehicles until it crashed. I made another version that didn't load pools of cars, but cars individually. This will mean the traffic diversity will be better: you won't see one type of cars driving around anymore like in v2. If the script detects that more than 35 cars are loaded, it simply stops. Once a it's less, it randomly selects a car out of the script and replaces the model that the game has just forgotten.
The chance that sport cars load are half the chance that normal cars load, and there are a lot of normal cars, so sports cars should be scarse, just like in the original game. When a sports car IS loaded, there won't be hundreds of them, even if you drive one. 
Beware of using trainers to spawn cars as they also request models. If you've been ingame for a pretty long time and spawn 5 more cars that you haven't seen in the 35 types of cars that already drive around you can expect a crash. I haven't experienced any other problems. You do need to play 2 minutes to have the script fully working, so when you've spawned from loading you can see a lot of taxis.
As for performance, if many high detail cars are onscreen and without this mod your game cripples, with this mod it does too. Can't do anything about that ;)

trafficloadv4.asi
Same as v3, but I lightened up some things. There are more taxis and busses compared to v3 and there is more traffic overall, resembles default GTA IV traffic density more. Fixed the chance of crashing while being on the airport.