XML Posted February 4, 2018 Share Posted February 4, 2018 Hello guys, i've seen in some servers that you can change the texture of the same vehicle many times, So you can seen other players having the same vehicle but another texture, I know that i have to use Shader functions but how to do it, And how to make all players able to see other player's vehicle texture ? Link to comment
KaMi Posted February 4, 2018 Share Posted February 4, 2018 If you find it very difficult to use shaders, I recommend changing the textures of an object and applying them to a car that is invisible (it will not give you as many problems as shaders) 8 minutes ago, XML said: Hello guys, i've seen in some servers that you can change the texture of the same vehicle many times, So you can seen other players having the same vehicle but another texture, I know that i have to use Shader functions but how to do it, And how to make all players able to see other player's vehicle texture ? If you find it very difficult to use shaders, I recommend changing the textures of an object and applying them to a car that is invisible (it will not give you as many problems as shaders) Link to comment
XML Posted February 4, 2018 Author Share Posted February 4, 2018 (edited) The problem is, If i used the texture instead of shaders, This will not be for only one vehicle, Unless if it was on client side for the local player, Which is not what i want, Shader can make it for a certain vehicle instead of all, That's why i start with it, It is difficult but i need to know how is that going to be Edited February 4, 2018 by XML Link to comment
NeXuS™ Posted February 4, 2018 Share Posted February 4, 2018 (edited) Pretty easy. This is the .fx file. //-- Declare the texture. These are set using dxSetShaderValue( shader, "Tex0", texture ) texture Tex0; technique simple { pass P0 { //-- Set up texture stage 0 Texture[0] = Tex0; //-- Leave the rest of the states to the default settings } } local openedImg = dxCreateTexture("test.png") local shaderFile = dxCreateShader("shader.fx") dxSetShaderValue(shaderFile, "Tex0", openedImg) engineApplyShaderToWorldTexture(shaderFile, "vehiclegrunge256") You can get the texture name using this resource. Edited February 5, 2018 by NeXuS™ Link to comment
KaMi Posted February 4, 2018 Share Posted February 4, 2018 No, no, i'm not saying you replace the texture of the car. I'm telling you to replace the textures of an object and attach it to the car Link to comment
XML Posted February 5, 2018 Author Share Posted February 5, 2018 @NeXuS™ I need to make a trigger to server side to apply it, So everyone can see it, But how about the new players that enters the server after the trigger is done ? Link to comment
NeXuS™ Posted February 5, 2018 Share Posted February 5, 2018 You'll have to create the synchronization for it. Using maybe an element-data, which would tell if he needs to load any textures on that car. You'll have to find your way around. 1 Link to comment
XML Posted February 5, 2018 Author Share Posted February 5, 2018 Alright thanks, I guess i'm going to use an element-data, That saves the texture, And there will be a loop on client side to search for vehicles, That have this element-data and load the shader for them. Link to comment
NeXuS™ Posted February 5, 2018 Share Posted February 5, 2018 Good luck on that, if you are stuck somewhere, feel free to post. 1 Link to comment
Moderators IIYAMA Posted February 5, 2018 Moderators Share Posted February 5, 2018 (edited) You probably need to save the pixels of the texture in stead of the texture. As textures are client-side only elements, which should not be able to sync.(Just in case if you get stuck there) https://wiki.multitheftauto.com/wiki/DxGetTexturePixels Even though a better way would be saving the file names, as every client does already have the textures. Edited February 5, 2018 by IIYAMA 1 Link to comment
Slim Posted February 5, 2018 Share Posted February 5, 2018 The sync for this is easy. theVehicle = getPedOccupiedVehicle ( thePlayer ) engineApplyShaderToWorldTexture( myShader, "vehiclegrunge256", theVehicle ) Link to comment
Slim Posted February 6, 2018 Share Posted February 6, 2018 (edited) Just save paint job string name with your preferred method (account data or MySQL or cookies) and use the above code I provided.. The client will check other players paint job string names for which paint job to use then it applies it accordingly, it can be tricky but that simple. Edited February 6, 2018 by Justin|X5| (Posted too late to edit my last post) 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