_ATTACH_CAM_TO_VEHICLE_BONE
DocsAttachCamToVehicleBone(cam, vehicle, boneIndex, relativeRotation, rotX, rotY, rotZ, offX, offY, offZ, fixedDirection)Description
This native works with vehicles only.
Bone indexes are usually given by this native GET_ENTITY_BONE_INDEX_BY_NAME.
Parameters
| Name | Type | Description |
|---|---|---|
cam | Cam | The camera handle. |
vehicle | Vehicle | The vehicle handle. |
boneIndex | int | — |
relativeRotation | BOOL | Whether or not the camera rotation will relative the vehicle rotation. |
rotX | float | The X rotation. |
rotY | float | The Y rotation. |
rotZ | float | The Z rotation. |
offX | float | The X offset direction. |
offY | float | The Y offset direction. |
offZ | float | The Z offset direction. |
fixedDirection | BOOL | Whether or not the camera direction will relative to the vehicle direction. |
Quick Snippet: Get CoordinatesrotXrotYrotZ
rotXrotYrotZAdd this command to your client script to retrieve precise locations in-game.
-- Add this to your client.lua. Type /pos in-game to copy coords.
RegisterCommand('pos', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local output = string.format("vector4(%.2f, %.2f, %.2f, %.2f)", coords.x, coords.y, coords.z, heading)
print(output)
TriggerEvent('chat:addMessage', { args = { '^4[COORD]^0', output } })
end)Quick Snippet: Get Vehiclevehicle
vehicleUse this to get the current vehicle handle for this native.
-- Get the vehicle the player is currently in
local ped = PlayerPedId()
local vehicle = GetVehiclePedIsIn(ped, false)
if vehicle ~= 0 then
print("Vehicle handle: " .. vehicle)
print("Model: " .. GetEntityModel(vehicle))
else
print("Player is not in a vehicle")
endQuick Snippet: Scripted Cameracam
camUse this to create and control a scripted camera for this native.
-- Create a scripted camera at the player's position
local coords = GetEntityCoords(PlayerPedId())
local cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)
SetCamCoord(cam, coords.x, coords.y, coords.z + 2.0)
SetCamRot(cam, -15.0, 0.0, GetEntityHeading(PlayerPedId()))
SetCamFov(cam, 70.0)
SetCamActive(cam, true)
RenderScriptCams(true, true, 500, true, true)
-- Restore gameplay camera:
-- RenderScriptCams(false, true, 500, true, true)
-- DestroyCam(cam, true)Vehicle Models

adder
alpha
blade
ardent
asea
cogcabrio
baller
blistaReturns
voidThis native does not return a value.