Scripting/Squirrel/Functions/Object.SetAlpha

From Vice City Multiplayer
Revision as of 11:37, 9 March 2016 by Rathore (talk | contribs) (Created page with "== Syntax == <pre>Object.SetAlpha( int alpha, int fadeTime )</pre> == Arguments == '''> Object''' - The pickup instance. * ''integer'' '''alpha''' - The alpha you want to...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing

Syntax

Object.SetAlpha( int alpha, int fadeTime )

Arguments

> Object - The pickup instance.

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

Example

This example will create a pickup and you can toggle visible it by commands given below.

function onScriptLoad()
{
   myObject <- CreateObject( 334, 1, Vector( -2261.12, 753.12, 211.123 ),255 );
}

function onPlayerCommand(player, cmd, text)
{
if (cmd =="visible")
{
myObject.SetAlpha( 255, 2500); // in 2.5 secs it will be totally visible
MessagePlayer("The object is going to visible now",player);
}
else if (cmd =="invisible")
{
myObject.SetAlpha( 0, 2500);// in 2.5 secs it will be totally invisible
MessagePlayer("The object is going to invisible now",player);
}
}