Doffy Posted November 17, 2019 Share Posted November 17, 2019 Hello everyone , today i'm trying to do weapon paintjob and i added a custom weapon of m4 and i wanna to added paintjob with shader substitute for txd , i have a problem , the weapon paint job is not shows when i added the shader to object it running , but when i trying to added it to my hand is not running ! code : local myShader_raw_data = [[ texture tex; technique replace { pass P0 { Texture[0] = tex; } } ]] local myShader6 = dxCreateShader(myShader_raw_data) -- create shader from raw data local myTexture6 = dxCreateTexture("image5.png") -- create texture from image file engineApplyShaderToWorldTexture(myShader6, "hk416_d") dxSetShaderValue(myShader6, "tex", myTexture6) pic : Link to comment
XaskeL Posted November 17, 2019 Share Posted November 17, 2019 If I had a resource, then it would be possible to test. And so, most likely, you will have to create weapon objects separately and synchronize the paintjob for each player to an individual weapon object. Link to comment
Castillo Posted November 18, 2019 Share Posted November 18, 2019 You have to apply the shader to the player element. local myShader_raw_data = [[ texture tex; technique replace { pass P0 { Texture[0] = tex; } } ]] local myShader6 = dxCreateShader(myShader_raw_data, 0, 0, false, "ped") -- create shader from raw data local myTexture6 = dxCreateTexture("image5.png") -- create texture from image file engineApplyShaderToWorldTexture(myShader6, "hk416_d", localPlayer) dxSetShaderValue(myShader6, "tex", myTexture6) Link to comment
JeViCo Posted November 18, 2019 Share Posted November 18, 2019 (edited) I made script a long time ago. I've tried to apply shader on weapon in different ways but got nothing. Weapons you holding are not actually objects (for some reason) and that's pretty annoying sometimes. Anyway i solved that problem: 1. I replace weapon with custom dff and txd with transparent texture. (You can see it in video below at the beginning. Replacing provides correct muzzle offset for custom weapon); 2. I replace 1 random object (not weapon) with my weapon's dff and txd normally; 3. When ped gets ak47 (weapon) i create shader with texture replacement, apply it on my object (not ped) and use render target as texture; 4. When i switch to ak47 i attach weapon to player's hand (using bone_attach resource) and remove it if i switch to another weapon; 5. I use render targets so i can easily redraw the texture and that's it. Edited November 18, 2019 by JeViCo more details added Link to comment
Doffy Posted November 18, 2019 Author Share Posted November 18, 2019 13 hours ago, Castillo said: You have to apply the shader to the player element. local myShader_raw_data = [[ texture tex; technique replace { pass P0 { Texture[0] = tex; } } ]] local myShader6 = dxCreateShader(myShader_raw_data, 0, 0, false, "ped") -- create shader from raw data local myTexture6 = dxCreateTexture("image5.png") -- create texture from image file engineApplyShaderToWorldTexture(myShader6, "hk416_d", localPlayer) dxSetShaderValue(myShader6, "tex", myTexture6) how can i type command in F8 and the shader start to only me and all players can saw it ? Link to comment
Overkillz Posted November 18, 2019 Share Posted November 18, 2019 1 hour ago, !#DesTroyeR_,) said: how can i type command in F8 and the shader start to only me and all players can saw it ? You need to deal with arrays. Link to comment
Castillo Posted November 18, 2019 Share Posted November 18, 2019 @JeViCo The weapon somehow belongs to the ped, so you can just apply the shader to the ped element using the weapon texture name, here's an example of this working: @!#DesTroyeR_,) You will have to make a system which syncs the paintjob equipped on each player, then apply it when the player streams in, and remove it when the player streams out. You can use either element data or events to sync each player's paintjob. Link to comment
Doffy Posted November 18, 2019 Author Share Posted November 18, 2019 1 minute ago, Castillo said: @JeViCo The weapon somehow belongs to the ped, so you can just apply the shader to the ped element using the weapon texture name, here's an example of this working: @!#DesTroyeR_,) You will have to make a system which syncs the paintjob equipped on each player, then apply it when the player streams in, and remove it when the player streams out. You can use either element data or events to sync each player's paintjob. yep , i wanna to do like this but i can't do it because I don't understand the Shaders Link to comment
Castillo Posted November 18, 2019 Share Posted November 18, 2019 You already have the shader code above, all you have to do now is create a system to sync which paintjob(s) the player has currently equipped. Link to comment
komal Posted November 20, 2019 Share Posted November 20, 2019 (edited) you need applie the shader to the txd , i know you dont understand in shader so i build simple script how this work . https://community.multitheftauto.com/index.php?p=resources&s=details&id=16502 Edited November 20, 2019 by komal 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