I thought I could make a little tutorial about how to import car mods into your maps.
As most of you probably know, car mods always contain a *.dff and a *.txd file (there are ones which contain more files but let's just focus on those 2).
The *.txd file is the texture of the car, the *.dff the visual model. Anyway, we will need to replace existing models of GTA when we want to import custom ones.
1. Get the Model ID of the , in our case, vehicle you want to replace. Here is a list of most GTA vehicles including their IDs:
http://wiki.multitheftauto.com/wiki/Vehicle_IDs2.Download or use a vehicle mod, which you wanna use in your map later. Like I said above, you need the *.txd and the *.dff file.
3.Now we need to set up our script and include some files to our map.
We must make a *.lua script. You can create one with every text editor. Into this script you have to post following code:
function replaceModel()
txd = engineLoadTXD ( "<NAME>.txd" )
engineImportTXD ( txd, CarID )
dff = engineLoadDFF ( "<NAME>.dff", CarID )
engineReplaceModel ( dff, CarID )
end
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel)
Instead of "<NAME>" you must use the name of the files you have in your mod. For the CarID you set the ID of the vehicle you want to replace.
3a.Now we just need to modify our
meta.xml file. You need to add these lines under your <meta> tag, that means nearly at the top of the file:
<script src="client.lua" type="client" />
<file src="<NAME>.txd" type="client" />
<file src="<NAME>.dff" type="client" />
(Instead of "<NAME>" you must put the name of the mod files again)
Well this just makes the map importing the files we need, that means our *.dff and *.txd files but also our script which is placed
client sided.