CreateCamera
Docslocal retval = CreateCamera(camHash, active)Description
Creates a camera with the specified camera hash, You can use `SET_CAM_` natives to manipulate the camera.
Make sure to call [RENDER_SCRIPT_CAMS](#\_0x07E5B515DB0636FC) once the camera is created, or this won't have any visible effect.
Take a look at [CREATE_CAM](#\_0xC3981DCE61D9E13F) if you would like to see the available camera names.
```
NativeDB Introduced: v323
```
Parameters
| Name | Type | Description |
|---|---|---|
camHash | Hash | The hash of the camera type, use [GET_HASH_KEY](#\_0xD24D37CC275948CC) to get the camera hash from the name. |
active | BOOL | Set to true if you wish to make this new camera the active camera. |
Quick Snippet: Scripted Camera→ Cam
→ 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)Returns
CamExamples
Official
-- creates a camera with the "DEFAULT_SCRIPTED_CAMERA" type
local cam = CreateCamera(GetHashKey("DEFAULT_SCRIPTED_CAMERA"), true)
RenderScriptCams(true, false, 0, true, true)