toxicsmoke11

restricting who can see a shader

Recommended Posts

hey i have a question

if i have a shader (like custom weapon texture for example) how can i make it that everyone can see that I have that texture, but their guns still remain with default weapon texture?

Share this post


Link to post

i think that i've tried using that targetElement before to myself, and only i could see the shader while others seen default on me D:

i need that others see my custom texture while they have default one(so its basically 2 textures of same weapon at same time just on different player)

Share this post


Link to post

you can setElementData to players you want to have the shader (serverside) and then apply/remove the shader to/from the players (clientside) using onClientElementDataChange event

Share this post


Link to post
you can setElementData to players you want to have the shader (serverside) and then apply/remove the shader to/from the players (clientside) using onClientElementDataChange event

Sometimes it doesn't work as I tried along time ago

Share this post


Link to post
you can setElementData to players you want to have the shader (serverside) and then apply/remove the shader to/from the players (clientside) using onClientElementDataChange event

Sometimes it doesn't work as I tried along time ago

Works perfectly for me. Also, you can check vehicle lights shader as an example, downloadable in community.mtasa.com

Share this post


Link to post
you can setElementData to players you want to have the shader (serverside) and then apply/remove the shader to/from the players (clientside) using onClientElementDataChange event

Sometimes it doesn't work as I tried along time ago

Works perfectly for me. Also, you can check vehicle lights shader as an example, downloadable in community.mtasa.com

Brilliant! Thanks mate

Share this post


Link to post

i tried this(not full code)

function onJoinHydra(player) 
if getElementModel(source) ~= 520 then return end 
if not getElementData(source,"mod") then setElementData(source,"veh",true) end 
  
   engineApplyShaderToWorldTexture(hydraShader,"hydrabody256",source) 
end 
addEventHandler("onClientVehicleEnter",root,onJoinHydra) 

result:

only i can see custom hydra texture, others see the default

i need others to usually see default hydras, but if i spawn a hydra and enter it, ONLY that hydra will get custom texture, and everyone will be able to see that cusom texture on my hydra

please help

Share this post


Link to post

Just create the vehicle using createVehicle and apply texture to it.

Share this post


Link to post

applying the texture wasn't the problem

i have fixed the problem by looping through all players in the server, and then applying the shader to that specific vehicle

Share this post


Link to post

If you remove the targetElement argument, it will automatically apply it to everyone.

Share this post


Link to post
If you remove the targetElement argument, it will automatically apply it to everyone.

If he'd do that, he would get what he didnt want:

Every hydra would have custom texture

Share this post


Link to post

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.