Starztec Posted September 13, 2017 Share Posted September 13, 2017 function addPaintjob(commandName,paintjobID) me = getLocalPlayer() if isPedInVehicle ( me ) then triggerServerEvent ( "addPJ", resourceRoot, tonumber(paintjobID), me ) end end addCommandHandler ("addpaintjob",addPaintjob) function addPaintjob2(paintjobID,player) if paintjobID == 1 then myTexture = dxCreateTexture( "paintjob1.png" ) elseif paintjobID == 2 then myTexture = dxCreateTexture( "paintjob2.png" ) elseif paintjobID == 3 then myTexture = dxCreateTexture( "paintjob3.png" ) elseif paintjobID == 4 then myTexture = dxCreateTexture( "paintjob4.png" ) elseif paintjobID == 5 then myTexture = dxCreateTexture( "paintjob5.png" ) elseif paintjobID == 6 then myTexture = dxCreateTexture( "paintjob6.png" ) else if player == getLocalPlayer() then outputChatBox ("There is no such paintjob ID!") return end end engineRemoveShaderFromWorldTexture ( shader_cars, "vehiclegrunge256", getPedOccupiedVehicle(player) ) shader_cars, tec = dxCreateShader ( "shader.fx" ) engineApplyShaderToWorldTexture ( shader_cars, "vehiclegrunge256", getPedOccupiedVehicle(player) ) dxSetShaderValue ( shader_cars, "TX0", myTexture ) end addEvent( "addPJ2", true ) addEventHandler( "addPJ2", getLocalPlayer(), addPaintjob2 ) function removePaintjob2(player) if engineApplyShaderToWorldTexture ( shader_cars, "vehiclegrunge256", getPedOccupiedVehicle(player) ) then me = getLocalPlayer() engineRemoveShaderFromWorldTexture ( shader_cars, "vehiclegrunge256", getPedOccupiedVehicle(player) ) removePaintjob2(player) end end addEvent( "removePJ2", true ) addEventHandler( "removePJ2", getLocalPlayer(), removePaintjob2 ) function removePaintjob() triggerServerEvent ( "removePJ", resourceRoot, getLocalPlayer() ) end addCommandHandler ("removepaintjob",removePaintjob) It works everything to wonder, but when it comes to paintjob for certain imported vehicles you can not.How could you apply a paintjob to these vehicles? I do not want to change color, but have multiple skin... Thanks for you Attention Link to comment
Discord Moderators Pirulax Posted September 13, 2017 Discord Moderators Share Posted September 13, 2017 You cant, but not all texture names are the same. Try using shader_tex_names . Just click on 'Texture names' on the top of the page. Btw, you should use getLocalPlayer() instead of resourceRoot. For some reason wiki says that resourceRoot is better, but in reality its much worse because of event faking. And why do u recreate the shader every time? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now