Squirrel/Server/Functions/Objects/FindObject
From Liberty Unleashed Wiki
(Difference between revisions)
Line 26: | Line 26: | ||
</code> | </code> | ||
− | This command will try to find the | + | This command will try to find the specified object id. |
=== Notes === | === Notes === |
Revision as of 03:12, 8 March 2010
This function finds an object from an ID and returns the pointer. If no object is found, null will be returned.
Syntax
Object FindObject( int id )
Arguments
- id - The ID of the object to be found
Example
function onPlayerCommand( player, cmd, text ) { if ( cmd == "findobj" ) { local obj; if ( text ) obj = FindObject( text.tointeger() ); if ( obj ) MessagePlayer( "Succesfully found object id: " + text + "!", player ); else MessagePlayer( "Unable to find an object with id: " + text + "!", player ); } }
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.