Skip to content

CreateAnimScene is not synchronized #3256

Open
@klandestino7

Description

@klandestino7

What happened?

Apparently, the animation does not execute for the other clients; the only things that change are the entity's position and rotation.

Video -> https://streamable.com/y1h6an

Image

Expected result

The animation will be displayed correctly for all players

Reproduction steps

Being in two instances, it will only work correctly for the client that runs the code; for the others, the player will not play anim.

Importancy

Slight inconvenience

Area(s)

RedM

Specific version(s)

b1491

Additional information

RegisterCommand("runAnimSeat", function(_ ,args)
    CameraPlayerEnterSeatAnim(PlayerPedId())
end)

local eAnimSceneFlag = 
{
	ASF_NONE = 0,
	ASF_LOOPING = (1 << 0),
	ASF_HOLD_AT_END = (1 << 1),
	ASF_AUTO_START_WHEN_LOADED = (1 << 2),
	ASF_BLOCK_TIME_SLICING = (1 << 3),
	ASF_ENABLE_RESUME_FROM_LAST_CHECKPOINT = (1 << 4),
	ASF_ABORT_SCENE_ON_REQUIRED_ENTITY_REMOVAL = (1 << 5),
	ASF_ADAPT_TO_TERRAIN = (1 << 6),
	ASF_FORCE_DISPLAY_IN_DEBUG_BAR = (1 << 7),
	ASF_BLOCK_SKIPPING = (1 << 8),
	ASF_ALLOW_LARGE_IMPACT_BREAKOUTS = (1 << 9),
	ASF_PREVENT_IGNORING_COLLISION_WITH_PARENT = (1 << 10),
	ASF_ENABLE_LETTER_BOX = (1 << 11),
	ASF_DISABLE_SCREEN_EVENTS_IF_NO_PLAYER = (1 << 12),
	ASF_PRESERVE_CAMERA_ON_PLAYER_REMOVAL = (1 << 13),
	ASF_MP_FORCE_SCREEN_EVENTS_IF_NO_PLAYER = (1 << 14),
	ASF_MP_RESTRICT_SCOPE_TO_SCRIPT_PARTICIPANTS = (1 << 15)
};

local animSceneSeat = {'script@mini_game@poker@mp_enters_%s', "PBL_ENTER_BASE_0%s"}
function CameraPlayerEnterSeatAnim( ped )
    local isMale = IsPedMale(ped)

    local sceneName = (animSceneSeat[1]):format(isMale and "male" or "male")
    local sceneAnimName = (animSceneSeat[2]):format(math.random(1,2))

    local animScene = CreateAnimScene(sceneName, 
        eAnimSceneFlag.ASF_HOLD_AT_END |
        eAnimSceneFlag.ASF_DISABLE_SCREEN_EVENTS_IF_NO_PLAYER |
        eAnimSceneFlag.ASF_MP_RESTRICT_SCOPE_TO_SCRIPT_PARTICIPANTS |
        eAnimSceneFlag.ASF_PRESERVE_CAMERA_ON_PLAYER_REMOVAL, 
        sceneAnimName, false, true
    );
    
    LoadAnimScene(animScene);

    while N_0x477122b8d05e7968(animScene, true,  false) == 0 do
        LoadAnimScene(animScene);
        Wait(0); 
    end

    Wait(1)

    local coords = GetEntityCoords( ped )
    local offsetRotation = GetEntityRotation( ped )
    local vectorUp = vec3(0, 0, 0.40)

    SetAnimSceneOrigin(animScene, coords - vectorUp, offsetRotation, 2)
    SetAnimSceneEntity(animScene, "player", ped, 0);

    StartAnimScene(animScene);
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    RedMIssues/PRs related to RedMbugtriageNeeds a preliminary assessment to determine the urgency and required action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions