FindVehicle

From Liberty Unleashed Wiki
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

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

Syntax

  1. Vehicle FindVehicle( int id )

Arguments

  • id - The ID of the vehicle to be found

Example

This command will find a vehicle with id specified in the text parameter.

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "findveh" )
  5. {
  6. local veh = null;
  7. if ( text ) veh = FindVehicle( text.tointeger() );
  8. if ( veh ) MessagePlayer( "Found a vehicle with ID: " + text + "!", player );
  9. }
  10. return 1;
  11. }
  12.  

Notes

The function MessagePlayer and call onPlayerCommand were used in this example. More info about them in the corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox