GetVehicleRespawnRotation: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(There are no commas in return types in other function syntax section)
 
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
float float float getVehicleRespawnRotation ( element theVehicle )
float float float getVehicleRespawnRotation ( vehicle theVehicle )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[vehicle]]:getRespawnRotation|respawnRotation}}
{{OOP||[[vehicle]]:getRespawnRotation|respawnRotation}}
Line 16: Line 16:


==Example==
==Example==
{{Example}}
This example outputs the player's current vehicle respawn position.
<section name="Server" class="server" show="true">
<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)
    else
        outputChatBox("you are not in the car",player,255,0,0)
    end
end
addCommandHandler("getRespawnPos",getRespawnPosition)
</syntaxhighlight>
</section>


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

Latest revision as of 23:03, 6 September 2024

This function retrieves the respawn rotation of a vehicle.

Syntax

float float float getVehicleRespawnRotation ( vehicle theVehicle )

OOP Syntax Help! I don't understand this!

Method: vehicle:getRespawnRotation(...)
Variable: .respawnRotation


Required Arguments

  • theVehicle: The vehicle which you'd like to retrieve the respawn rotation of.

Returns

Returns three floats indicating the respawn rotation of the vehicle, x, y and z respectively.

Example

This example outputs the player's current vehicle respawn position.

Click to collapse [-]
Server
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)
    else
        outputChatBox("you are not in the car",player,255,0,0)
    end
end 
addCommandHandler("getRespawnPos",getRespawnPosition)

See Also