FindObject

From Liberty Unleashed Wiki
Revision as of 10:51, 11 October 2010 by VRocker (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

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

Syntax

  1. Object FindObject( int id )

Arguments

  • id - The ID of the object to be found

Example

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "findobj" )
  5. {
  6. local obj;
  7. if ( text ) obj = FindObject( text.tointeger() );
  8.  
  9. if ( obj ) MessagePlayer( "Succesfully found object id: " + text + "!", player );
  10. else MessagePlayer( "Unable to find an object with id: " + text + "!", player );
  11. }
  12. }
  13.  

This command will try to find the specified object 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