SetVehicleRespawnPosition: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
 
(12 intermediate revisions by 6 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
This function sets the position (and rotation) the vehicle will respawn to.
This function sets the position (and rotation) the vehicle will respawn to.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool setVehicleRespawnPosition ( vehicle theVehicle, float x, float y, float z, [float rx, float ry, float rz ] )</syntaxhighlight>
<syntaxhighlight lang="lua">bool setVehicleRespawnPosition ( vehicle theVehicle, float x, float y, float z [, float rx, float ry, float rz ] )</syntaxhighlight>
 
{{OOP||[[vehicle]]:setRespawnPosition|respawnPosition}}
===Required Arguments===
===Required Arguments===
*'''theVehicle''': The [[vehicle]] you wish to change the respawn delay of.
*'''theVehicle''': The [[vehicle]] you wish to change the respawn position of.
* '''x''': A floating point number representing the X coordinate on the map.
* '''x''': A floating point number representing the X coordinate on the map.
* '''y''': A floating point number representing the Y coordinate on the map.
* '''y''': A floating point number representing the Y coordinate on the map.
Line 13: Line 14:
===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.
{{UsingRadians}}
 


==Returns==
==Returns==
Returns 'true' if the vehicle was found and edited.
Returns ''true'' if the vehicle was found and edited, ''false'' otherwise.


==Example==
==Example==
This example creates a vehicle and changes its respawn position.
This example creates a vehicle and changes its respawn position.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
vehicle = createVehicle ( 400, 1, 1, 1 ) -- create us a new vehicle
local vehicle = createVehicle ( 400, 1, 1, 1 ) -- create us a new vehicle
if ( vehicle ) then
if ( vehicle ) then
   setVehicleRespawnPosition ( vehicle, 10, 10, 10 ) -- tell the server to respawn the vehicle at position(10,10,10)
   setVehicleRespawnPosition ( vehicle, 10, 10, 10 ) -- tell the server to respawn the vehicle at position (10,10,10)
end
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Vehicle functions}}
{{Vehicle_functions|server}}

Latest revision as of 23:05, 6 September 2024

This function sets the position (and rotation) the vehicle will respawn to.

Syntax

bool setVehicleRespawnPosition ( vehicle theVehicle, float x, float y, float z [, float rx, float ry, float rz ] )

OOP Syntax Help! I don't understand this!

Method: vehicle:setRespawnPosition(...)
Variable: .respawnPosition


Required Arguments

  • theVehicle: The vehicle you wish to change the respawn position of.
  • 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.

Returns

Returns true if the vehicle was found and edited, false otherwise.

Example

This example creates a vehicle and changes its respawn position.

local vehicle = createVehicle ( 400, 1, 1, 1 ) -- create us a new vehicle
if ( vehicle ) then
  setVehicleRespawnPosition ( vehicle, 10, 10, 10 ) -- tell the server to respawn the vehicle at position (10,10,10)
end

See Also