Using IMG archives for your content


This page describes how you can work with IMG archives through IMG DL, as well as provide advice on how to best utilize it. We'll try to re-implement a vehicle that was removed in Snapshot 4.2 - the Deviant, whose models are stored in an IMG archive. We will be using the script approach to do so.

As always, we start by adding our IMG file to assets.json as follows:

[
    ...
	{
		"name": "IMG DL - Test for IMG DL",
		"author": "dkluin",
		"type": "cdimages",
		"files": [
			"imgdl-test/imgdl-test.img"
		]
	}
]

As you can see, we don't need to define the models as they are already stored in the IMG archive. The file loader is clever enough to determine which files are stored in IMG archives and which ones aren't.

We can thus go straight to the scripting part and tell the file loader about our file:

public OnGameModeInit()
{
    ...

    // Tell the file loader about our IMG archive, and add our vehicle.
    AddCdImage("imgdl-test/imgdl-test.img");

    AddVehicleModel(3151, "ul_deviant", "ul_deviant", VEHICLE_TYPE_AUTOMOBILE, "URANUS", "DEVIANT", "null", VEHICLE_CLASS_RICHFAMILY, 7, 0, 0, -1, 0.74, 0.74, 1);
    return 1;
}

So yeah, this is all there is to it. You can now restart your server and test the changes. You can read more about how to add vehicles here.


What can be stored in IMG archives?

IMG archives which are added through DL may only contain the following files:

  • Models (DFFs)
  • Texture dictionaries (TXDs) - paintjobs are supported as well (paintjob DL)
  • Collision archives

Other files such as streamed IPLs and animations are not supported at the moment.


Good practices when working with IMG archives

As said, we recommend you to use IMG DL as much as possible, and to organize your files in numerous small-to-medium-sized IMG archives. The reasoning behind this is that the smaller your IMG archives are the less players have to download should you update some of your assets. It's all about balance - with just one or a handful of IMG archives players have to wait a long time before they'll be able to play. If you have too many files you'll end up losing track of where you stored your models.

In any case, here's an example of how we recommend you to organize your assets (we more or less do the same thing with GTA: Underground itself!):

  • Categorize your assets. Store your vehicles in one archive, and your peds in another. If you want, separate donator-exclusive content fro mthe normal content and give them their own IMG archives as well.
  • Use sensible names. You shouldn't have to waste time trying to find where you can find what you are looking for.
  • Be sensible.