Jump to content

How to replace paintjobs?


Recommended Posts

Posted

Anyone can explain me how to replace paintjobs?
I wrote this script and it's not working :(
 

function replacepaintjob() 
 paintjob1 = engineLoadTXD ( "elegy1.txd" ) 
engineImportTXD (paintjob1, [562]={0})
 paintjob2 = engineLoadTXD ( "elegy2.txd" ) 
engineImportTXD (paintjob2, [562]={1})
 paintjob3 = engineLoadTXD ( "elegy3.txd" ) 
engineImportTXD (paintjob3, [562]={2})
end
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replacepaintjob)
 
addCommandHandler ( "reloadmodel", replacepaintjob )

And please explain me how to use paintjob IDs in MTA Wiki Paintjob.

  • Moderators
Posted
function replacepaintjob() 
	local paintjob1 = engineLoadTXD ( "elegy1.txd" ) 
	engineImportTXD (paintjob1, 562)
  
	local paintjob2 = engineLoadTXD ( "elegy2.txd" ) 
	engineImportTXD (paintjob2, 562)
  
	local paintjob3 = engineLoadTXD ( "elegy3.txd" ) 
	engineImportTXD (paintjob3, 562)
end

I haven't replaced paintjobs myself, but this will solve some syntax errors in your code.

 

And make sure that all 3 files are written down in the meta.xml:

https://wiki.multitheftauto.com/wiki/Meta.xml

 

<file src="elegy1.txd" />
<file src="elegy2.txd" />
<file src="elegy3.txd" />

 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

You can't use engineImportTXD as this function takes a model ID as an argument and paintjobs are not models. You have to use a shader to replace paintjob textures.

  • Thanks 1

Lua Scripter

?ucet=miki_cz

Owner of mshost.cz MTA portal.

  • 7 months later...
Posted

I would like to learn how to make the script to add Paintjobs custom.

On 28/05/2018 at 11:45, MIKI785 said:

You can't use engineImportTXD as this function takes a model ID as an argument and paintjobs are not models. You have to use a shader to replace paintjob textures.

 

 

The greatest pleasure of life is doing what people think impossible

 

El mayor placer de la vida es hacer aquello que la gente cree imposible

Posted
On 28/05/2018 at 10:10, barankaplan05 said:

I don't know how to make a shader. Can you explain me how to do that?

The link that @TheMOG posted has the shader you'll need.

Please do not PM me with scripting related question nor support, use the forums instead.

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...