Scripting/Squirrel/Functions/Object.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 "== Syntax == <pre>Object.SetAlpha( int alpha, int fadeTime )</pre> == Arguments == '''> Object''' - The pickup instance. * ''integer'' '''alpha''' - The alpha you want to...")
 
No edit summary
Line 13: Line 13:
== Example ==
== Example ==


This example will create a pickup and you can toggle visible it by commands given below.
This example will create a object and you can toggle visible it by commands given below.
<pre>function onScriptLoad()
<pre>function onScriptLoad()
{
{

Revision as of 11:37, 9 March 2016

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 object 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);
}
}