CreateVehicle

From Liberty Unleashed Wiki
Revision as of 15:58, 29 September 2010 by Force (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 creates a new vehicle and returns a pointer to it. If the vehicle couldn't be created the function will return null.

Syntax

CreateVehicle can take different lists of parameters:

  1. Vehicle CreateVehicle( int model, Vector pos, float angle, [ int col1, int col2 ] )
  1. Vehicle CreateVehicle( int model, float x, float y, float z, float angle, [ int col1, int col2 ] )

Arguments

  • model - The model of the vehicle. See a list of vehicle model constants here
  • pos - The position of the new vehicle as a vector
  • angle - The rotation of the created vehicle in degrees
  • col1 - Colour 1 of the vehicle. Using -1 will select a random colour specific for that vehicle model. This is an optional argument
  • col2 - Colour 2 of the vehicle. Using -1 will select a random colour specific for that vehicle model. This is an optional argument
  • x, y, z - The position of the new vehicle as floats

Example

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "veh" )
  5. {
  6. CreateVehicle( VEH_INFERNUS, pPlayer.Pos, pPlayer.Angle, -1, -1 );
  7. }
  8.  
  9. return 1;
  10. }
  11.  

Notes

The event onPlayerCommand was used in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox