WASSIm. Posted April 21, 2013 Share Posted April 21, 2013 (edited) hi guys. how make show shader if player dead ? local screenWidth, screenHeight = guiGetScreenSize() local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight) local flickerStrength = 0 local blurStrength = 0.000 local noiseStrength = 0.000 addEventHandler("onClientResourceStart", resourceRoot, function() if getVersion ().sortable < "1.1.0" then outputChatBox("Resource is not compatible with this client.") return else createShader() end end) function createShader() oldFilmShader, oldFilmTec = dxCreateShader("shaders/old_film.fx") if (not oldFilmShader) then outputChatBox("Could not create oldFilmShader. Please use debugscript 3") else outputChatBox("Using technique " .. oldFilmTec) end end function updateShader() upDateScreenSource(thePlayer) if (oldFilmShader) then local flickering = math.random(100 - flickerStrength, 100)/100 dxSetShaderValue(oldFilmShader, "ScreenSource", myScreenSource); dxSetShaderValue(oldFilmShader, "Flickering", flickering); dxSetShaderValue(oldFilmShader, "Blurring", blurStrength); dxSetShaderValue(oldFilmShader, "Noise", noiseStrength); dxDrawImage(0, 0, screenWidth, screenHeight, oldFilmShader) end end addEventHandler("onClientPreRender", root, updateShader) function upDateScreenSource() dxUpdateScreenSource(myScreenSource) end Edited April 21, 2013 by Guest Link to comment
Jaysds1 Posted April 21, 2013 Share Posted April 21, 2013 try this: local screenWidth, screenHeight = guiGetScreenSize() local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight) local flickerStrength = 0 local blurStrength = 0.000 local noiseStrength = 0.000 local oldFilmShader, oldFilmTec function createShader() oldFilmShader, oldFilmTec = dxCreateShader("shaders/old_film.fx") if not oldFilmShader then outputChatBox("Could not create oldFilmShader. Please use debugscript 3") else outputChatBox("Using technique " .. oldFilmTec) end end addEventHandler("onClientResourceStart", resourceRoot,function() if getVersion ().sortable < "1.1.0" then outputChatBox("Resource is not compatible with this client.") return end createShader() end) function upDateScreenSource() dxUpdateScreenSource(myScreenSource) end function updateScreen() upDateScreenSource() if oldFilmShader then --check localPlayers health local flickering = math.random(100 - flickerStrength, 100)/100 dxSetShaderValue(oldFilmShader, "ScreenSource", myScreenSource) dxSetShaderValue(oldFilmShader, "Flickering", flickering) dxSetShaderValue(oldFilmShader, "Blurring", blurStrength) dxSetShaderValue(oldFilmShader, "Noise", noiseStrength) dxDrawImage(0, 0, screenWidth, screenHeight, oldFilmShader) end end addEventHandler("onClientPlayerWasted",localPlayer,function() addEventHandler("onClientPreRender", root,updateScreen) end) addEventHandler("onClientPlayerSpawn",localPlayer,function() removeEventHandler("onClientPreRender",root,updateScreen) end) Link to comment
WASSIm. Posted April 21, 2013 Author Share Posted April 21, 2013 try this:local screenWidth, screenHeight = guiGetScreenSize() local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight) local flickerStrength = 0 local blurStrength = 0.000 local noiseStrength = 0.000 local oldFilmShader, oldFilmTec function createShader() oldFilmShader, oldFilmTec = dxCreateShader("shaders/old_film.fx") if not oldFilmShader then outputChatBox("Could not create oldFilmShader. Please use debugscript 3") else outputChatBox("Using technique " .. oldFilmTec) end end addEventHandler("onClientResourceStart", resourceRoot,function() if getVersion ().sortable < "1.1.0" then outputChatBox("Resource is not compatible with this client.") return end createShader() end) function upDateScreenSource() dxUpdateScreenSource(myScreenSource) end function updateScreen() upDateScreenSource() if oldFilmShader then --check localPlayers health local flickering = math.random(100 - flickerStrength, 100)/100 dxSetShaderValue(oldFilmShader, "ScreenSource", myScreenSource) dxSetShaderValue(oldFilmShader, "Flickering", flickering) dxSetShaderValue(oldFilmShader, "Blurring", blurStrength) dxSetShaderValue(oldFilmShader, "Noise", noiseStrength) dxDrawImage(0, 0, screenWidth, screenHeight, oldFilmShader) end end addEventHandler("onClientPlayerWasted",localPlayer,function() addEventHandler("onClientPreRender", root,updateScreen) end) addEventHandler("onClientPlayerSpawn",localPlayer,function() removeEventHandler("onClientPreRender",root,updateScreen) end) nothing Link to comment
Castillo Posted April 21, 2013 Share Posted April 21, 2013 Works perfect here, it enables it when I die, and disables when I respawn. Link to comment
WASSIm. Posted April 21, 2013 Author Share Posted April 21, 2013 Works perfect here, it enables it when I die, and disables when I respawn. yes i want that but nothing Link to comment
Castillo Posted April 21, 2013 Share Posted April 21, 2013 Just copy Jaysd code and replace yours with it, it works fine. Link to comment
WASSIm. Posted April 21, 2013 Author Share Posted April 21, 2013 Just copy Jaysd code and replace yours with it, it works fine. i copy and restart script x100000000 and reopened server but nothing Link to comment
WASSIm. Posted April 21, 2013 Author Share Posted April 21, 2013 "OldFilmShader" description="Old Film Shader v1" author ="Sam@ke" version="1.0.0" type="script" /> Link to comment
Jaysds1 Posted April 21, 2013 Share Posted April 21, 2013 there's no type for file tags: meta.xml try this: > name ="OldFilmShader" description="Old Film Shader v1" author ="Sam@ke" version="1.0.0" type="script" /> ="shader.lua" type="client"/> src="shaders/old_film.fx"/>> Link to comment
WASSIm. Posted April 21, 2013 Author Share Posted April 21, 2013 there's no type for file tags: meta.xmltry this: > name ="OldFilmShader" description="Old Film Shader v1" author ="Sam@ke" version="1.0.0" type="script" /> ="shader.lua" type="client"/> src="shaders/old_film.fx"/>> thxx Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now