OnClientPedsProcessed

From Multi Theft Auto: Wiki
Revision as of 15:31, 4 February 2024 by LordHenry (talk | contribs) (→‎Example)
Jump to navigation Jump to search

This event is triggered after GTA updates bone transformations for all peds. This event can be used for updating bones.

Parameters

None.

Source

The source of this event is the client's root element.

Example

addEventHandler("onClientPedsProcessed",root,function() -- add the event
    for i,v in ipairs(getElementsByType('player',root,true)) do  -- loop all players
        
        -- just an exmaple anim
        setElementBoneRotation(v, 33, 0, 295.2, 0)
        setElementBoneRotation(v, 23, 0, 298.8, 0)
        setElementBoneRotation(v, 4, 0, 46.8, 0)
        setElementBoneRotation(v, 2, 0, 0, 32.4)

        updateElementRpHAnim(v) -- Update ped bones animations

    end 
end)

This example makes the localPlayer handcuffed. The player can still run/walk/jump/crouch.

addEventHandler("onClientPedsProcessed", root, function()
    -- Left
    setElementBoneRotation(localPlayer, 32, 26.57374382019, 61.337575733622, 59.206573486328)
    setElementBoneRotation(localPlayer, 33, 27.843754291534, 15.3639249801636, 46.40625)
    setElementBoneRotation(localPlayer, 34, -81.018516340527, 342.87482380867, 326.11833715439)
    -- Right
    setElementBoneRotation(localPlayer, 22, 338.839179039, 53.49357098341, 298.45233917236)
    setElementBoneRotation(localPlayer, 23, 307.68748283386, 22.110015869141, 313.59375)
    setElementBoneRotation(localPlayer, 24, 96.047592163086, 357.88313293457, 56.739406585693)

    updateElementRpHAnim(localPlayer)
end)

Requirements

This template will be deleted.

Warning

This event will trigger whatever function it is attached to with every frame. Depending on the server's maximum FPS and what your computer might handle - you might end up triggering the function 30-60 times per second.

As a result, this event may cause severe lag and/or even crashes if not used cautiously.

See Also

Game Processing Order

Other client events


Client event functions