RebootDxD Posted June 27, 2020 Share Posted June 27, 2020 (edited) I wrote a resource that replaces vehiclelights128 but ran into a problem. I need to replace the vehiclelights128 file for each model separately (for each car its own vehiclelights128). What can I do? local myShader_raw_data = [[ texture Tex0; technique simple { pass P0 { Texture[0] = Tex0; } } ]] local theTechnique = dxCreateShader(myShader_raw_data) local myShader_raw_data_on = [[ texture Tex1; technique simple { pass P0 { Texture[0] = Tex1; } } ]] local theTechniqueon = dxCreateShader(myShader_raw_data_on) local texture = dxCreateTexture("vehlights.png") local texture = dxCreateTexture("vehlightson.png") function applyShader(thePlayer, seat) local theVehicle = source if seat == 0 and thePlayer == localPlayer then dxSetShaderValue(theTechnique,"Tex0",texture) dxSetShaderValue(theTechniqueon,"Tex1",texture) engineApplyShaderToWorldTexture(theTechnique, "vehiclelights128", theVehicle) engineApplyShaderToWorldTexture(theTechniqueon, "vehiclelightson128", theVehicle) end end addEventHandler("onClientVehicleEnter", getRootElement(), applyShader) Edited June 27, 2020 by RebootDxD Link to comment
Moderators Patrick Posted June 27, 2020 Moderators Share Posted June 27, 2020 local myShader_raw_data = [[ texture Tex0; technique simple { pass P0 { Texture[0] = Tex0; } } ]] local theTechnique = dxCreateShader(myShader_raw_data) local theTechniqueon = dxCreateShader(myShader_raw_data) local texture = dxCreateTexture("vehlights.png") local texture_on = dxCreateTexture("vehlightson.png") dxSetShaderValue(theTechnique,"Tex0", texture) dxSetShaderValue(theTechniqueon,"Tex0", texture_on) -- replace everywhere, not only for a specific element (don't use 3rd arg) engineApplyShaderToWorldTexture(theTechnique, "vehiclelights128") engineApplyShaderToWorldTexture(theTechniqueon, "vehiclelightson128") 1 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