Jump to content

SOLVED.


Bean666

Recommended Posts

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 by Guest
Link to comment

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

504981f3dc.png

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

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