RegisterEntityForCutscene
DocsRegisterEntityForCutscene(cutsceneEntity, cutsceneEntName, p2, modelHash, p4)Description
This can only be run once <code>CAN_REQUEST_ASSETS_FOR_CUTSCENE_ENTITY</code> is true, but can be run before <code>HAS_CUTSCENE_LOADED</code>
Parameters
| Name | Type | Description |
|---|---|---|
cutsceneEntity | Entity | Entity to put into the cutscene. |
cutsceneEntName | char* | cHandle of cutscene entity, i.e Michael, MP\_1, MP\_4, Lamar |
p2 | int | — |
modelHash | Hash | Not strictly neccasary, often 0 in R\* scripts |
p4 | int | 0 for SP, 64 for MP seemingly |
Quick Snippet: Get EntitycutsceneEntity
cutsceneEntityUse this to obtain an entity handle from the player's aim or crosshair.
-- Get the entity the player is aiming at
local ped = PlayerPedId()
local hit, entity = GetEntityPlayerIsFreeAimingAt(PlayerId())
if hit and entity ~= 0 then
print("Entity: " .. entity)
print("Model: " .. GetEntityModel(entity))
print("Type: " .. GetEntityType(entity)) -- 1=Ped, 2=Vehicle, 3=Object
endQuick Snippet: Load Model HashmodelHash
modelHashModels must be loaded before use. This snippet handles requesting and releasing properly.
-- Properly load a model before spawning/using it
local modelName = "prop_barrel_01a" -- change to your model
local modelHash = GetHashKey(modelName)
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Wait(0)
end
print("Model loaded: " .. modelName .. " (" .. modelHash .. ")")
-- Release when done:
-- SetModelAsNoLongerNeeded(modelHash)Returns
voidThis native does not return a value.
Examples
Official
-- An example that allows for registering non player_zero peds in place, i.e MP peds.
RequestCutscene("family_5_mcs_5_p5", 8)
repeat Wait(0) until CanRequestAssetsForCutsceneEntity()
SetCutscenePedComponentVariationFromPed("Michael", PlayerPedId(), 0)
-- Registering can occur at any point past here before starting the cutscene.
RegisterEntityForCutscene(PlayerPedId(), "Michael", 0, 0, 64)
repeat Wait(0) until HasCutsceneLoaded()
StartCutscene(0)