Dzsozi (h03) Posted March 20, 2014 Posted March 20, 2014 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
Castillo Posted March 20, 2014 Posted March 20, 2014 The first argument of onPlayerWasted is the total ammo, so you must change your function arguments to this: function addBlueOnDamage ( totalAmmo, killer )
Dzsozi (h03) Posted March 20, 2014 Author Posted March 20, 2014 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
Castillo Posted March 20, 2014 Posted March 20, 2014 Any errors in the debugscript? does it do anything at all?
DNL291 Posted March 20, 2014 Posted March 20, 2014 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
Dzsozi (h03) Posted March 20, 2014 Author Posted March 20, 2014 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!
Castillo Posted March 20, 2014 Posted March 20, 2014 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
DNL291 Posted March 20, 2014 Posted March 20, 2014 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now