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
 
(2 intermediate revisions by one other user not shown)
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()
<source lang=squirrel>
function onScriptLoad()
{
{
   myObject <- CreateObject( 334, 1, Vector( -2261.12, 753.12, 211.123 ),255 );
   myObject <- CreateObject( 334, 1, Vector( -2261.12, 753.12, 211.123 ),255 );
Line 32: Line 33:
}
}
}
}
</pre>
</source>
 
=== Notes ===
Call [[onPlayerCommand]] and [[onScriptLoad]] were used in this example. More info about them in the corresponding pages.
 
== Related Functions ==
 
{{Scripting/Squirrel/Functions/Object_Functions}}
[[Category:Scripting/Squirrel/Functions/Object_Functions]]

Latest revision as of 18:33, 30 January 2017

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

Notes

Call onPlayerCommand and onScriptLoad were used in this example. More info about them in the corresponding pages.

Related Functions