Jump to content

Synchronization Shaders


KostyanR

Recommended Posts

You'd have to route the call to apply shaders through the server and broadcast it to all clients (and clients who join afterwards)

Example:

-- client
triggerServerEvent("announceEnableShader", localPlayer, some_data) -- place this whereever you enable the shader instead of enabling it. This announces the client's intentions to the server and the server broadcasts this to all clients (including this client) and these clients all enable the shader on their end

addEvent("broadcastEnableShader", true) -- allow remotely triggered (from server)
addEventHandler("broadcastEnableShader", root, 
  function(some_data) -- receive broadcast from the server
    -- engineApplyShaderToWorldTexture or whatever you want. Source of this event is the player who announced the shader (so you can know which element to apply a shader to, for example)
  end
)

-- server
addEvent("announceEnableShader", true) -- allow remotely triggered (from client)
addEventHandler("announceEnableShader", root, 
  function (some_data) -- receive announcement from client
    triggerClientEvent(root, "broadcastEnableShader", source, some_data) -- broadcast it to all clients (all children of root)
  end
)

 

Edited by MrTasty
  • Like 2
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...