Jump to content

[HELP]


Recommended Posts

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 by RebootDxD
Link to comment
  • Moderators
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")

 

  • Thanks 1
Link to comment

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