Jump to content

Add fadecamera when other player is wasted


Recommended Posts

Hey guys! So today I tried to make a script which is make the killer person's screen fade to blue for a second when he kills somebody. Unfortunately, it's not working and I don't know why. :( Can anybody help me in this please?

function addBlueOnDamage ( killer ) 
    local killerPerson = getPlayerName ( killer ) 
    if ( source == killer ) then 
        fadeCamera ( killer, false, 1.0, 75, 161, 214 ) 
        setTimer ( fadeCameraDelayed, 500, 1, killer ) 
    end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), addBlueOnDamage ) 
  
function fadeCameraDelayed(killer) 
      if (isElement(killer)) then 
            fadeCamera(killer, true, 0.5) 
      end 
end 

Link to comment

Try this:

function addBlueOnDamage ( totalAmmo, killer ) 
    local killerPerson = getPlayerName ( killer ) 
    if getElementType(killer) == "player" then 
        fadeCamera ( killer, false, 1.0, 75, 161, 214 ) 
        setTimer ( fadeCameraDelayed, 500, 1, killer ) 
    end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), addBlueOnDamage ) 
  
function fadeCameraDelayed(killer) 
      if (isElement(killer)) then 
            fadeCamera(killer, true, 0.5) 
      end 
end 

Link to comment
Try this:
function addBlueOnDamage ( totalAmmo, killer ) 
    local killerPerson = getPlayerName ( killer ) 
    if getElementType(killer) == "player" then 
        fadeCamera ( killer, false, 1.0, 75, 161, 214 ) 
        setTimer ( fadeCameraDelayed, 500, 1, killer ) 
    end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), addBlueOnDamage ) 
  
function fadeCameraDelayed(killer) 
      if (isElement(killer)) then 
            fadeCamera(killer, true, 0.5) 
      end 
end 

Works, thank you very much!

Any errors in the debugscript? does it do anything at all?

Debugscript haven't showed me any errrors, but now it works. Thank you for you two!

Link to comment
Try this:
function addBlueOnDamage ( totalAmmo, killer ) 
    local killerPerson = getPlayerName ( killer ) 
    if getElementType(killer) == "player" then 
        fadeCamera ( killer, false, 1.0, 75, 161, 214 ) 
        setTimer ( fadeCameraDelayed, 500, 1, killer ) 
    end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), addBlueOnDamage ) 
  
function fadeCameraDelayed(killer) 
      if (isElement(killer)) then 
            fadeCamera(killer, true, 0.5) 
      end 
end 

Works, thank you very much!

You're welcome.

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