Sign in to follow this  
MatreN

[Help] Black and White Screen!

Recommended Posts

Hello guys, I want to switch black and white screen, but I don't know how to do it, can you help me?
I want it to work when we touch the marker.

Share this post


Link to post
local screenX, screenY = guiGetScreenSize()
local screenSource = dxCreateScreenSource(screenX, screenY)

addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
function()
    if getVersion ().sortable < "1.1.0" then
        outputChatBox("Resource is not compatible with this client.")
        return
    else
        blackWhiteShader, blackWhiteTec = dxCreateShader("fx/blackwhite.fx")
        
        if (not blackWhiteShader) then
            outputChatBox("Could not create shader. Please use debugscript 3.")
        else
            outputChatBox("shader " .. blackWhiteTec .. " was started.")
        end
    end
end)


function doBlackAndWhite()
    if (blackWhiteShader) then
        dxUpdateScreenSource(screenSource)     
        dxSetShaderValue(blackWhiteShader, "screenSource", screenSource)
        dxDrawImage(0, 0, screenX, screenY, blackWhiteShader)
    end
end



local marker = createMarker(0, 0, 3, "cylinder", 2)

addEventHandler("onClientMarkerHit", marker, function()
    addEventHandler("onClientPreRender", getRootElement(), doBlackAndWhite)
end)

addEventHandler("onClientMarkerLeave", marker, function()
    removeEventHandler("onClientPreRender", getRootElement(), doBlackAndWhite)
end)

Edit blackwhite.Lua

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.