Jump to content

[HELP] Scripting


illestiraqi

Recommended Posts

  • MTA Team

I think the fact that you give a link to an automatic generator doesn't teach him anything - only that he gets what he wants without putting any effort to it.

First of all, texture replacements are client-side and work as a normal resource. You need two files for normal purposes (TXD, DFF). You need to load these files via the meta.xml file and via the client-side .lua file.

I made you a simple example of how it can be done. I do not suggest generators because it takes more time than doing this manually. If you want to improve your lua skills in MTA, then you should just script everything by yourself and not use anyone else's scripts - just saying.

Replacing the skin ID 9

skin_txd = engineLoadTXD("models/9.txd") 
engineImportTXD(skin_txd, 9) 
skin_dff = engineLoadDFF("models/9.dff", 0) 
engineReplaceModel(skin_dff, 9) 

Replacing the vehicle ID 411 (Infernus)

vehicle_txd = engineLoadTXD("models/Infernus.txd") 
engineImportTXD(vehicle_txd, 411) 
vehicle_dff = engineLoadDFF("models/Infernus.dff", 411) 
engineReplaceModel(vehicle_dff, 411) 

If you want to replace something else than vehicles, then your engineLoadDFF's second argument must be a zero. Otherwise you must enter the vehicle ID.

<meta> 
    <info name="Replacement of textures" type="script" /> 
    <script src="c_replace.lua" type="client" /> 
    <file src="models/9.txd" /> 
    <file src="models/9.dff" /> 
    <file src="models/Infernus.txd" /> 
    <file src="models/Infernus.dff" /> 
</meta> 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...