GetVehicleRespawnPosition: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Useful Function}} <lowercasetitle/> __NOTOC__ This function allows you to get the respawn Position of a specific vehicle element. '''Note:''' Please insert this code in a f...") |
m (→See Also) |
||
(8 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{Server function}} | ||
__NOTOC__ | __NOTOC__ | ||
This function | {{New feature/item|3.0156|1.5.5|14053|This function retrieves the respawn coordinates of a [[vehicle]].}} | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">float | <syntaxhighlight lang="lua"> | ||
float float float getVehicleRespawnPosition ( vehicle theVehicle ) | |||
</syntaxhighlight> | |||
{{OOP||[[vehicle]]:getRespawnPosition|respawnPosition|setVehicleRespawnPosition}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
* '''theVehicle''' | *'''theVehicle:''' The [[vehicle]] which you'd like to retrieve the respawn coordinates of. | ||
===Returns=== | ===Returns=== | ||
Returns | Returns three [[float|floats]] indicating the respawn coordinates of the [[vehicle]], ''x'', ''y'' and ''z'' respectively. | ||
== | ==Example== | ||
<section name="Server | This example outputs the player's current vehicle respawn position. | ||
<section name="Server" class="server" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function getRespawnPosition(player) | |||
local veh = getPedOccupiedVehicle(player) | |||
if veh then | |||
local x,y,z = getVehicleRespawnPosition(veh) | |||
local rx,ry,rz = getVehicleRespawnRotation(veh) | |||
outputChatBox("this car respawn in x = "..x.." y = "..y.." z = "..z.." rx = "..rx.." ry = "..rz,player,0,255,0) | |||
function | else | ||
outputChatBox("you are not in the car",player,255,0,0) | |||
end | |||
end | |||
addCommandHandler("getRespawnPos",getRespawnPosition) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> | ||
==See Also== | ==See Also== | ||
{{ | {{Vehicle_functions|server}} |
Latest revision as of 23:03, 6 September 2024
This function retrieves the respawn coordinates of a vehicle.
Syntax
float float float getVehicleRespawnPosition ( vehicle theVehicle )
OOP Syntax Help! I don't understand this!
- Method: vehicle:getRespawnPosition(...)
- Variable: .respawnPosition
- Counterpart: setVehicleRespawnPosition
Required Arguments
- theVehicle: The vehicle which you'd like to retrieve the respawn coordinates of.
Returns
Returns three floats indicating the respawn coordinates of the vehicle, x, y and z respectively.
Example
This example outputs the player's current vehicle respawn position.
Click to collapse [-]
Serverfunction getRespawnPosition(player) local veh = getPedOccupiedVehicle(player) if veh then local x,y,z = getVehicleRespawnPosition(veh) local rx,ry,rz = getVehicleRespawnRotation(veh) outputChatBox("this car respawn in x = "..x.." y = "..y.." z = "..z.." rx = "..rx.." ry = "..rz,player,0,255,0) else outputChatBox("you are not in the car",player,255,0,0) end end addCommandHandler("getRespawnPos",getRespawnPosition)
See Also
- addVehicleSirens
- getModelHandling
- getVehicleIdleRespawnDelay
- getVehicleRespawnDelay
- getVehicleRespawnPosition
- getVehicleRespawnRotation
- getVehiclesOfType
- isVehicleRespawnable
- removeVehicleSirens
- resetVehicleExplosionTime
- resetVehicleIdleTime
- respawnVehicle
- setModelHandling
- setVehicleIdleRespawnDelay
- setVehicleRespawnDelay
- setVehicleRespawnPosition
- setVehicleRespawnRotation
- spawnVehicle
- toggleVehicleRespawn
- Shared
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates