Bean666 Posted April 15, 2015 Share Posted April 15, 2015 (edited) hello guys i need help this is client side , it works screen goes red by fade camera but i can't see my character , is there any way i can see my character while in a red screen? code: addEventHandler ("onClientPreRender", root, function () if (getPlayerTeam (localPlayer) and getTeamName (getPlayerTeam (localPlayer)) == "Zombies") then fadeCamera ( false, 1.0, 100, 0, 0 ) else fadeCamera( true, 0.5) end end ) Edited April 16, 2015 by Guest Link to comment
Enargy, Posted April 15, 2015 Share Posted April 15, 2015 Not tested. addEventHandler ("onClientResourceStart", resourceRoot, function () fade = 0 end) addEventHandler ("onClientResourceStop", resourceRoot, function () fadeCamera( true, 0 ) end) addEventHandler ("onClientPreRender", root, function () if (getPlayerTeam (localPlayer) and getTeamName (getPlayerTeam (localPlayer)) == "Zombies") then fade = fade+0.5 fadeCamera ( false, fade, 100, 0, 0 ) else fadeCamera( true, 0) fade = 0 end end ) Link to comment
Tomas Posted April 16, 2015 Share Posted April 16, 2015 local s, x = guiGetScreenSize( ) local shader = { Filepath="shader.fx"} function shader.UpdateScreen( ) dxSetRenderTarget( ) dxUpdateScreenSource( shader.Screen ) dxDrawImage( 0, 0, s, x, shader.Object ) end addEventHandler("onClientPreRender", root, function ( ) if getPlayerTeam(localPlayer) and getTeamName ( getPlayerTeam ( localPlayer ) ) == "Zombies" then if isElement(shader.Object) then return end shader.Object = dxCreateShader(shader.Filepath) shader.Screen = dxCreateScreenSource( s, x ) dxSetShaderValue( shader.Object, "RedTexture", shader.Screen ) addEventHandler( "onClientHUDRender", root, shader.UpdateScreen ) else if isElement(shader.Object) then destroyElement( shader.Object ) destroyElement( shader.Screen ) removeEventHandler( "onClientHUDRender", root, shader.UpdateScreen ) end end end ) shader.fx texture RedTexture; sampler screenSampler = sampler_state { Texture = <RedTexture>; }; float4 main(float2 uv : TEXCOORD0) : COLOR0 { float4 Color; Color = tex2D( screenSampler , uv); Color.rgb = (Color.r+Color.g+Color.b)/3.0f; if (Color.r<0.2 || Color.r>0.9) Color.r = 255; else Color.r = 1.0f; if (Color.g<0.2 || Color.g>0.9) Color.g = 0; else Color.g = 1.0f; if (Color.b<0.2 || Color.b>0.9) Color.b = 0; else Color.b = 1.0f; return Color; }; technique Red { pass P1 { PixelShader = compile ps_2_0 main(); } } Link to comment
Bean666 Posted April 16, 2015 Author Share Posted April 16, 2015 Not tested. addEventHandler ("onClientResourceStart", resourceRoot, function () fade = 0 end) addEventHandler ("onClientResourceStop", resourceRoot, function () fadeCamera( true, 0 ) end) addEventHandler ("onClientPreRender", root, function () if (getPlayerTeam (localPlayer) and getTeamName (getPlayerTeam (localPlayer)) == "Zombies") then fade = fade+0.5 fadeCamera ( false, fade, 100, 0, 0 ) else fadeCamera( true, 0) fade = 0 end end ) this works good , is there anyway that dxdrawimage works here also with the red screen? i also need it guigetscreensize. 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