Scripting/Squirrel/Functions/FindSphere: 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 "Retrieve a sphere object from sphere's ID. == Syntax == <pre>FindSphere( id )</pre> == Arguments == * ''integer'' '''id''' - The sphere's ID. == Example == <source lang=s...")
 
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
== Arguments ==
== Arguments ==


* ''integer'' '''id''' - The sphere's ID.
* ''int'' '''id''' - The sphere's ID.


== Example ==
== Example ==
<source lang=squirrel>
<source lang=squirrel>
function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "sphere" )
     if ( cmd == "sphere" )
     {
     {
Line 19: Line 21:
         MessagePlayer( "[#ffffff] Teleport to sphere " + text + ".", player );
         MessagePlayer( "[#ffffff] Teleport to sphere " + text + ".", player );
     }
     }
}
</source>
</source>


=== Notes ===
=== Notes ===
Call [[Scripting/Squirrel/Events/Player/onPlayerCommand|onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
Call [[onPlayerCommand]] were used in this example. More info about them in the corresponding pages.


== Related Functions ==
== Related Functions ==


{{Scripting/Squirrel/Functions/Sphere_Functions}}
{{Scripting/Squirrel/Functions/Sphere_Functions}}

Latest revision as of 20:41, 14 March 2016

Retrieve a sphere object from sphere's ID.

Syntax

FindSphere( id )

Arguments

  • int id - The sphere's ID.

Example

function onPlayerCommand( player, cmd, text )
{
    if ( cmd == "sphere" )
    {
         local sphere = FindSphere( text );

         if ( !sphere ) MessagePlayer( "[#ffffff]Can't find sphere " + text + ".", player );
         else player.Pos = sphere.Pos;
         MessagePlayer( "[#ffffff] Teleport to sphere " + text + ".", player );
    }
}

Notes

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

Related Functions