GetVehicleDummyPosition: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Fixed wrong related functions)
Line 21: Line 21:
Returns three floats indicating the position ''x'', ''y'' and ''z'' of the vehicle's dummy. It returns ''false'' otherwise.
Returns three floats indicating the position ''x'', ''y'' and ''z'' of the vehicle's dummy. It returns ''false'' otherwise.


==Example==
This is a command to get the position of the player's vehicle dummy position specified as an argument.
{{Needs Example}}
<syntaxhighlight lang="lua">
function getDummyPosition(cmd, dummy)
    if (not dummy) then
        return false
    end
    local veh = getPedOccupiedVehicle(localPlayer)
    if (not veh) then
        outputChatBox("You should be in a vehicle to use this command", 255, 25, 25)
        return false
    end
    local x, y, z = getVehicleDummyPosition(veh, dummy)
    outputChatBox("X: "..x..", Y: "..y..", Z: "..z, 0, 255, 0)
end
addCommandHandler("getdummy", getDummyPosition)
</syntaxhighlight>


==Requirements==
==Requirements==

Revision as of 02:36, 4 February 2021


This function returns the position of the dummy for the given vehicle.

Syntax

float, float, float getVehicleDummyPosition ( vehicle theVehicle, string dummy )

OOP Syntax Help! I don't understand this!

Method: vehicle:getDummyPosition(...)
Counterpart: setVehicleDummyPosition


Required Arguments

  • theVehicle: The vehicle you want to get the dummy positions from
  • dummy: The dummy whose position you want to get

Allowed dummies

  • light_front_main: Primary front lights position.
  • light_rear_main: Primary rear lights position.
  • light_front_second: Secondary front lights position.
  • light_rear_second: Secondary rear lights position.
  • seat_front: Front seat position.
  • seat_rear: Rear seat position.
  • exhaust: Exhaust fumes start position.
  • engine: Engine smoke start position.
  • gas_cap: Vehicle gas cap position (shooting it will explode vehicle).
  • trailer_attach: Point at which trailers will be attached to vehicle.
  • hand_rest: Point at which the steer of a bike is held.
  • exhaust_second: Secondary exhaust position (for example in NRG-500)
  • wing_airtrail: Point from which air trail will show in airplanes, visible while in sharp turns.
  • veh_gun: Vehicle gun position (ex. Rustler).

Returns

Returns three floats indicating the position x, y and z of the vehicle's dummy. It returns false otherwise.

This is a command to get the position of the player's vehicle dummy position specified as an argument.

function getDummyPosition(cmd, dummy)
    if (not dummy) then
        return false
    end
    local veh = getPedOccupiedVehicle(localPlayer)
    if (not veh) then
        outputChatBox("You should be in a vehicle to use this command", 255, 25, 25)
        return false
    end
    local x, y, z = getVehicleDummyPosition(veh, dummy)
    outputChatBox("X: "..x..", Y: "..y..", Z: "..z, 0, 255, 0)
end
addCommandHandler("getdummy", getDummyPosition)

Requirements

This template will be deleted.

See Also