Scripting/Squirrel/Functions/Player.SetAlpha: Difference between revisions

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing
(Created page with "== Example == <source lang=squirrel> function onPlayerCommand( player, cmd, text ) { if ( cmd == "invisible" ) { player.SetAlpha(0,0) } else if ( cmd == "visible"...")
 
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Syntax ==
<pre>Player.SetAlpha( int alpha, int fadeTime )</pre>
== Arguments ==
'''> Player''' - The player instance.
* ''integer'' '''alpha''' - The alpha you want to set, 0 to 255.
* ''integer'' '''fadeTime''' - The fadeTime miliseconds, in how much time the alpha fully affect.
== Example ==
== Example ==
<source lang=squirrel>
<source lang=squirrel>
Line 5: Line 18:
   if ( cmd == "invisible" )
   if ( cmd == "invisible" )
   {
   {
     player.SetAlpha(0,0)
     player.SetAlpha( 0, 2500); // in 2.5 secs it will be totally invisible
   }
   }
   else if ( cmd == "visible" )
   else if ( cmd == "visible" )
   {
   {
     player.SetAlpha(255,255)
     player.SetAlpha( 255, 2500); // in 2.5 secs it will be totally visible
   }
   }
}
}


</source>
</source>
== Related Functions ==
{{Scripting/Squirrel/Functions/Player Functions}}
[[Category:Scripting/Squirrel/Functions/Player_Functions]]

Latest revision as of 18:56, 30 January 2017

Syntax

Player.SetAlpha( int alpha, int fadeTime )

Arguments

> Player - The player instance.

  • integer alpha - The alpha you want to set, 0 to 255.
  • integer fadeTime - The fadeTime miliseconds, in how much time the alpha fully affect.


Example

function onPlayerCommand( player, cmd, text )
{
  if ( cmd == "invisible" )
  {
    player.SetAlpha( 0, 2500); // in 2.5 secs it will be totally invisible
  }
  else if ( cmd == "visible" )
  {
    player.SetAlpha( 255, 2500); // in 2.5 secs it will be totally visible
  }
}

Related Functions

Player Game Functions

These functions exist for compatibility with the R2 Squirrel server.