FadeCamera

From Multi Theft Auto: Wiki
Revision as of 09:57, 21 October 2006 by MrJax (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function will fade a player's camera to a color or back to normal over a specified time period.

Syntax

bool fadeCamera ( player thePlayer, bool fadeIn, [ float timeToFade = 1.0, int red = 0, int green = 0, int blue = 0 ] )

Required Arguments

  • thePlayer: The player whos camera you wish to fade.
  • fadeIn: Should the camera be faded in our out? Pass true to fade the camera in, false to fade it out to a color.

Optional Arguments

  • timeToFade The number of seconds it should take to fade.
  • red The ammount of red in the color that the camera fades out to (0 - 255). Not require for fading in.
  • green The ammount of green in the color that the camera fades out to (0 - 255). Not require for fading in.
  • blue The ammount of blue in the color that the camera fades out to (0 - 255). Not require for fading in.

Returns

Returns true if the camera was faded succesfully, false if invalid arguments were passed to the function.

Example

This example fades a player called someguy's camera to red over a period of 2 seconds, then after half a second fade it back to normal again over a period of 1 second.

myPlayer = getPlayerFromNick ( "someguy" ) -- find a player called someguy to test this on
fadeCamera ( myPlayer, false, 2.0, 255, 0, 0 ) -- fade the player's camera to red over a period of 2 seconds
setTimer ( "fadeCamera", 2500, 1, myPlayer, true, 1.0 ) -- set a timer to fade it back again in 2.5 seconds over 1 second

See Also