Jump to content

Restore Shaders


Overkillz

Recommended Posts

Hey dear community, Im having a little issue to restore map shaders. I already used getElementsByType and apply it to an table to save all the datas that it got. It work pretty well while removing, but when i want to restore them, I don't know what can I put on the 2nd argument of engineApplyShaderToWorldTexture

function lalala()
	if(#shadersTab > 0)then
		for i,shaderr in ipairs(shadersTab)do
			engineApplyShaderToWorldTexture( shaderr, "What to put here ?" )
		end
	end
end

I hope u can understand me, Regards.

Link to comment

Why don't you just recall the function where it applies the shaders?

So for example:

function lalala()
	if(#shadersTab > 0)then
		for i,shaderr in ipairs(shadersTab)do
			applyShaders()
		end
	end
end
function applyShaders()
  -- this is the function where you replace the textures
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource())) -- or whatever is here

If I understand you - and what you are trying to do - correctly, that's what you are trying to do.

Link to comment

No, I think u didn't understand me. Well, let me explain slowly.

Some mappers apply shaders to their maps like skybox, watershaders ...etc

I started the script and the first of the script works pretty well, it removes all the shaders IF THE PLAYER WANTS by clicking a simple key. However, If they want to restore it, they can't, I want to allow them to restore the shaders that were removed previously. Thats why I don't know what should I put on the second argument  of engineApplyShaderToWorldTexture

Regards.

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