Jump to content

How to Replace sniper scope on the server


Andrew75t

Recommended Posts

  • Moderators
Posted

Hi!
You can replace the texture with engineApplyShaderToWorldTexture.

-- CLIENT SIDE

local raw_shader = [[
	texture TEXTURE;
	technique TexReplace {
		pass P0 {
			Texture[0] = TEXTURE;
		}
	}
]]

addEventHandler("onClientResourceStart", root, function()
    local shader  = dxCreateShader(raw_shader)
    local texture = dxCreateTexture("crosshair.png")
    dxSetShaderValue(shader, "TEXTURE", texture)
    engineApplyShaderToWorldTexture(shader, "snipercrosshair")
end)

 

Crosshair image (crosshair.png): https://i.imgur.com/BzfPcsO.png

  • Thanks 1
Posted

I tried to change the texture of the sight in a graphical editor and replace it through txdWorkShop, but it did not change, as well as the weapon icon, what is it connected with?  I'll try your script, thanks for your answer.

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