Jump to content

[Help] Change Clothes TXD


Recommended Posts

Hey people,

me and a friend are running a small fun server.

We have a "big" Problem.

I Designed a new T-Shirt (txd) and we wanted to have it in the Server.

Is it possible? I would like to change the tshirtwhite.txd (in players.img*) to my own .txd

It would be really helpful if you could give me a .LUA file.

Thank you in advice!

Edited by Guest
Link to comment

Shader is a helper in this case but then you don't need .txd but a .png or .dds

https://wiki.multitheftauto.com/wiki/Shader_examples - check "shader_tex_names" and use it to get the name of the tshirt you want to replace (you probably know its original name from .txd so it will save you time)

This is a simple shader which replaces in-game texture with your image file (eg .png, NOT .txd)

texture gTexture; 
technique replace 
{ 
    pass P0 
    { 
        Texture[0] = gTexture; 
    } 
} 

All you need to script is:

    txd = dxCreateTexture( "your_texture.png" ); 
    if not txd then 
        txd = nil; -- it's best to nil a variable because it'll waste unnecessary memory 
        return false; 
    end 
    shader = dxCreateShader( "shader_file.fx" ); -- the content of this file should be what I included above 
    if not shader then 
        destroyElement( txd ); 
        txd = nil; 
        return false; 
    end 
    dxSetShaderValue( shader, "gTexture", txd ); -- gTexture is inside the shader file which you want to set with your texture 
    engineApplyShaderToWorldTexture( shader, "name_of_the_texture" ); -- this is the name of texture you want to replace eg. "tshirtwhite" 

If you want to replace another texture you will have to use the same code as above but with different names/filenames.

Link to comment

dude, i'm trying to be nice.

so i pasted the 2. code in a lua file and pasted in my variables, added the meta and customized it. i created a shader_file.fx file with the 1. code and when i load it in the server i dont get any errors, but the texture wont show

Link to comment
dude, i'm trying to be nice.

so i pasted the 2. code in a lua file and pasted in my variables, added the meta and customized it. i created a shader_file.fx file with the 1. code and when i load it in the server i dont get any errors, but the texture wont show

sorry for what i said before. :/

Show us your meta.xml and .lua file

Link to comment

The bottom code needs to go to a script file (.lua), the top one needs to go to shader file (.fx). Both of these files need to be inside a resource folder and added to meta.xml.

EDIT:

I've just tested it and unfortunately it doesn't seem to support ped textures (any ped texture, not just clothes).

Link to comment
The bottom code needs to go to a script file (.lua), the top one needs to go to shader file (.fx). Both of these files need to be inside a resource folder and added to meta.xml.

well okay i got it, pasted the 2. in a lua and the 1. in a .fx file named "shader_file.fx". so okay, like i said, i pasted all my variables, but when i start it i dont get any errors, but it wont show off, when im now in MTA (in my server) and go to Debugmode 3, i got the error that the technique is wrong. wheres the problem?

here's my .fx -

texture gTexture; 
technique replace 
{ 
    pass P0 
    { 
        Texture[0] = gTexture; 
    } 
} 

that's the .lua -

    txd = dxCreateTexture( "tshirtwhite.png" ); 
    if not txd then 
        txd = nil; -- it's best to nil a variable because it'll waste unnecessary memory 
        return false; 
    end 
    shader = dxCreateShader( "shader_file.fx" ); -- the content of this file should be what I included above 
    if not shader then 
        destroyElement( txd ); 
        txd = nil; 
        return false; 
    end 
    dxSetShaderValue( shader, "gTexture", texture ) 
    engineApplyShaderToWorldTexture( shader, "tshirtwhite" ); -- this is the name of texture you want to replace eg. "tshirtwhite" 

and here's the meta -

  
<meta> 
    <info description="Shader - Clothes" version="0.1.3" type="script" /> 
    <script src="clothes.lua" type="client" /> 
    <file src="shader_file.fx" type="client" /> 
    <file src="tshirtwhite.png" type="client" /> 
</meta> 
  

as a noob i really dont know what to do.

Link to comment
nothing.png

even with your test resource i get this error... something wrong with my mta server?

Might be, I'm not a shader pro and haven't seen many shader error messages. What MTA version are you using? Maybe it's your graphics card fault but you seem to run high resolution so the card isn't old.

Link to comment
nothing.png

even with your test resource i get this error... something wrong with my mta server?

Might be, I'm not a shader pro and haven't seen many shader error messages. What MTA version are you using? Maybe it's your graphics card fault but you seem to run high resolution so the card isn't old.

I'm using MTA 1.3

My Graphics Card can't be wrong... if ENB doesn't lag, why should there be problems with this?

Hmmm... But it worked for you?

Link to comment

Well, it works fine because I changed the texture name from "tshirtwhite" to "shad_ped" (shadow ped) and it replaced player's shadow with the texture of new tshit and I didn't get any error/warning message.

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