GetVehicleIDFromName

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

This function returns a vehicle model ID from the input string. If the input is an invalid model, the function will return 0.

Syntax

  1. int GetVehicleIDFromName( string name )

Arguments

  • name - The name of the vehicle you wish to return the model ID for

Example

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "modelid" )
  5. {
  6. if ( szText )
  7. {
  8. local iModel = GetVehicleIDFromName( szText );
  9. if ( iModel ) MessagePlayer( "Vehicle name - " + szText + " has the model id of " + iModel, pPlayer );
  10. }
  11. }
  12. return 1;
  13. }
  14.  

Notes

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

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox