Squirrel/Server/Functions/Pickups/FindPickup
From Liberty Unleashed Wiki
(Difference between revisions)
(→Example) |
|||
Line 1: | Line 1: | ||
− | + | {{Squirrel/Title|FindPickup}} | |
This function finds a pickup from an ID and returns the pointer. If no pickup is found, ''null'' will be returned. | This function finds a pickup from an ID and returns the pointer. If no pickup is found, ''null'' will be returned. | ||
Latest revision as of 11:11, 11 October 2010
This function finds a pickup from an ID and returns the pointer. If no pickup is found, null will be returned.
[edit] Syntax
Pickup FindPickup( int id )
[edit] Arguments
- id - The ID of the pickup to be found
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 ); } }
This command will try to find the specified pickup id.
[edit] Notes
The call onPlayerCommand was used in in this example. More info about this in the corresponding page.