Squirrel/Server/Functions/Camera/FadeCamera

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
m
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|FadeCamera}}
 
This function fades the camera for the given player. It is also possible to set the fading colour.
 
This function fades the camera for the given player. It is also possible to set the fading colour.
  
Line 19: Line 19:
  
 
== Example ==
 
== Example ==
 +
 +
When used, this command would fade the camera of the player that typed "/fade".
 +
 
<code lang="squirrel">
 
<code lang="squirrel">
 
function onPlayerCommand( player, cmd, text )
 
function onPlayerCommand( player, cmd, text )
 
{
 
{
    if ( cmd == "fade" ) FadeCamera( player, 5, false, 255, 0, 0 );
+
    if ( cmd == "fade" ) FadeCamera( player, 5.0, false, 255, 0, 0 );
 +
   
 +
    return 1;
 
}
 
}
 
</code>
 
</code>
Line 28: Line 33:
 
=== Notes ===
 
=== Notes ===
  
When used, this command would fade the camera of the player that typed "/fade".
+
The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in in this example. More info about this in the corresponding page.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Camera}}
 
{{Squirrel/Server/Functions/Camera}}

Latest revision as of 02:29, 25 September 2010

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function fades the camera for the given player. It is also possible to set the fading colour.

[edit] Syntax

FadeCamera can take 3 different lists of parameters. These are:

  1. bool FadeCamera( Player plr, float speed, bool fadeIn )
  1. bool FadeCamera( Player plr, float speed, bool fadeIn, Colour col )
  1. bool FadeCamera( Player plr, float speed, bool fadeIn, int r, int g, int b )

[edit] Arguments

  • plr - This is the pointer of the player to fade the camera for
  • speed - The fading speed. The higher the value, the slower the fade
  • fadeIn - A boolean representing whether the camera should be faded in or out
  • col - A pointer to a predefined colour object to set the fade colour
  • r, g, b - Integer values for the fading colours - red, green, blue. Values range from 0 to 255

[edit] Example

When used, this command would fade the camera of the player that typed "/fade".

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "fade" ) FadeCamera( player, 5.0, false, 255, 0, 0 );
  5. return 1;
  6. }
  7.  

[edit] Notes

The call onPlayerCommand was used in in this example. More info about this in the corresponding page.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox