Squirrel/Server/Functions/Pickups/FindPickup

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This function finds a pickup from an ID and returns the pointer. If no pickup is found, ''null'' will be returned. == Syntax == <code>Pickup FindPickup( int id )</code> == Arg...)
 
(Example)
Line 10: Line 10:
 
* '''id''' - The ID of the pickup to be found
 
* '''id''' - The ID of the pickup to be found
  
== Example ==
 
 
{{Squirrel/NeedsExample}}
 
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( player, cmd, text )
 +
{
 +
if ( cmd == "findpickup" )
 +
{
 +
local pup;
 +
if ( text ) pup = FindPickup( text.tointeger() );
 +
 
 +
if ( pup ) MessagePlayer( "Succesfully found pickup id: " + text + "!", player );
 +
else MessagePlayer( "Unable to find an pickup with id: " + text + "!", player );
 +
}
 +
}
 
</code>
 
</code>
  
 +
This command will try to find the specified pickup id.
 
=== Notes ===
 
=== Notes ===
  
-- Example notes here
+
The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in in this example. More info about this in the corresponding page.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Pickups}}
 
{{Squirrel/Server/Functions/Pickups}}

Revision as of 03:11, 8 March 2010

This function finds a pickup from an ID and returns the pointer. If no pickup is found, null will be returned.

Syntax

  1. Pickup FindPickup( int id )

Arguments

  • id - The ID of the pickup to be found
  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "findpickup" )
  5. {
  6. local pup;
  7. if ( text ) pup = FindPickup( text.tointeger() );
  8.  
  9. if ( pup ) MessagePlayer( "Succesfully found pickup id: " + text + "!", player );
  10. else MessagePlayer( "Unable to find an pickup with id: " + text + "!", player );
  11. }
  12. }
  13.  

This command will try to find the specified pickup id.

Notes

The call onPlayerCommand was used in in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox