Jump to content

CJ REPLACING


FantaItaly

Recommended Posts

Posted (edited)

The only way to replace CJ is with shaders.
Example;

 

Client.lua

addCommandHandler("change", function()
    triggerServerEvent( "Clothes", localPlayer)
    local shader1 = dxCreateShader( "shader.fx", 0, 0, false, "ped" )
    local torso = dxCreateTexture ( "WhiteCJ/torso.png" )--path of torso.png
    engineApplyShaderToWorldTexture ( shader1, "cj_ped_torso", localPlayer, true )--body part of cj(torso)
    dxSetShaderValue ( shader1, "gTexture", torso )

    local shader2 = dxCreateShader( "shader.fx", 0, 0, false, "ped" )
    local face = dxCreateTexture ( "WhiteCJ/face.png" )--path of face.png
    engineApplyShaderToWorldTexture ( shader2, "cj_ped_head", localPlayer, true )--body part of cj(head)
    dxSetShaderValue ( shader2, "gTexture", face )

    local shader3 = dxCreateShader( "shader.fx", 0, 0, false, "ped" )
    local legs = dxCreateTexture ( "WhiteCJ/legs.png" )--path of legs.png
    engineApplyShaderToWorldTexture ( shader3, "cj_ped_legs", localPlayer, true )--body part of cj(legs)
    dxSetShaderValue ( shader3, "gTexture", legs )


    local shader4 = dxCreateShader( "shader.fx", 0, 0, false, "ped" )
    local foot = dxCreateTexture ( "WhiteCJ/foot.png" )
    engineApplyShaderToWorldTexture ( shader4, "cj_ped_feet", localPlayer, true )
    dxSetShaderValue ( shader4, "gTexture", foot )
end)

shader.fx

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

 

The only error that you have is that if you have clothes that are also equipped you will change the texture, it is something that I have not been able to solve.
But if that is the code to replace CJ.

 

This script helps you to know the name of the shaders in the game, so you can change them.

https://nightly.multitheftauto.com/files/shaders/shader_tex_names.zip

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Edited by ~Hades~

POWERED BY HADES

Posted

It requires basic 3D modeling and shader skills.

I can do 3D vehicle/object mods and basic scripts from scratch, contact me for free help!!
Skype/Discord/Telegram: [email protected] / Justin|X5|#0977 / @JustinX5
Xtreme 5 Gaming - COMING SOON!

I'd love it if more people in MTA utilized these amazing features, so please ask me anything related to 3D modeling/basic scripting/etc.
The expert knows more and more about less and less until they know everything about nothing.

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