CreateVehicle: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
{{Needs_Checking|The example it outdated, I'll make a new one later.|[[User:Erorr404|Erorr404]]}}
__NOTOC__
__NOTOC__
This function creates a vehicle and returns a handle to the created vehicle. If it fails, it will return false. This can happen if you exceed the upper vehicle limit at 65535 or due to an another unspecified future reason.
This function creates a vehicle at the specified location.


==Syntax==
==Syntax==
Line 13: Line 15:
===Optional Arguments===
===Optional Arguments===
{{OptionalArg}}
{{OptionalArg}}
* '''rx''': A floating point number representing the rotation about the X axis in Radians.
* '''rx''': A floating point number representing the rotation about the X axis in Degrees.
* '''ry''': A floating point number representing the rotation about the Y axis in Radians.
* '''ry''': A floating point number representing the rotation about the Y axis in Degrees.
* '''rz''': A floating point number representing the rotation about the Z axis in Radians.
* '''rz''': A floating point number representing the rotation about the Z axis in Degrees.
* '''numberplate''': A string that will go on the number plate of the car (max 8 letters). This is only applicable to cars.
* '''numberplate''': A string that will go on the number plate of the car (max 8 letters). This is only applicable to cars.
{{UsingRadians}}
 
===Returns===
Returns the [[vehicle]] element that was created. Returns ''false'' if the arguments are incorrect, or if the vehicle limit of 65535 is exceeded.


==Example==
==Example==

Revision as of 23:48, 3 September 2006

Dialog-information.png This article needs checking.

Reason(s): The example it outdated, I'll make a new one later.


This function creates a vehicle at the specified location.

Syntax

vehicle createVehicle ( model, x, y, z, [rx, ry, rz, string numberplate] )

Required Arguments

  • model: The Vehicle IDs|vehicle ID of the vehicle being created.
  • x: A floating point number representing the X coordinate on the map.
  • y: A floating point number representing the Y coordinate on the map.
  • z: A floating point number representing the Z coordinate on the map.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • rx: A floating point number representing the rotation about the X axis in Degrees.
  • ry: A floating point number representing the rotation about the Y axis in Degrees.
  • rz: A floating point number representing the rotation about the Z axis in Degrees.
  • numberplate: A string that will go on the number plate of the car (max 8 letters). This is only applicable to cars.

Returns

Returns the vehicle element that was created. Returns false if the arguments are incorrect, or if the vehicle limit of 65535 is exceeded.

Example

function onPlayerChat ( player, chat )
  if ( strtok ( chat, 1, 32 ) == "!createhydra" ) then
    x, y, z = getPlayerPosition ( player )
    createVehicle ( 520, x + 5, y, z, 0, 0, 0 )
    outputChatBox ( "You got a hydra", player )
  end
end

See Also

GTASA IDs (vehicles, weapons, weathers, characters, colors): http://info.vces.net/ (Special thanks to Brophy and Ratt for making these lists)