Jump to content

help


WASSIm.

Recommended Posts

Posted (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 by Guest

Omerta Roleplay

Posted

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) 

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted
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

Omerta Roleplay

Posted

Works perfect here, it enables it when I die, and disables when I respawn.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Just copy Jaysd code and replace yours with it, it works fine.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted
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"/>>

thxx :D

Omerta Roleplay

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