Jump to content

Add fadecamera when other player is wasted


Recommended Posts

Posted

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 

Posted

The first argument of onPlayerWasted is the total ammo, so you must change your function arguments to this:

function addBlueOnDamage ( totalAmmo, killer ) 

Posted
The first argument of onPlayerWasted is the total ammo, so you must change your function arguments to this:
function addBlueOnDamage ( totalAmmo, killer ) 

Still not working :(

Posted

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 

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

Posted

Ah, I just checked your code again to see what was the difference and found it:

if ( source == killer ) then 

I missed that when first checked it :P

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

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