OnClientPedsProcessed: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client event}} {{New feature/item|3.0160|1.5.8|20704|This event is triggered after GTA updates bone transformations for all peds. This event can be used for updat...")
 
m (formatting)
 
(11 intermediate revisions by 6 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client event}}  
{{Client event}}  
{{New feature/item|3.0160|1.5.8|20704|This event is triggered after GTA updates bone transformations for all peds. This event can be used for updating bones.}}
{{Added feature/item|1.5.9|1.5.8|20704|This event is triggered after GTA updates bone transformations for all peds. This event can be used for updating bones.}}
{{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.}}
 
==Parameters==
None.


==Source==
==Source==
Line 8: Line 15:
==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
TODO
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)
</syntaxhighlight>
</syntaxhighlight>
This example makes the localPlayer handcuffed. The player can still run/walk/jump/crouch/shoot, use [[toggleControl]] to disable them.
<syntaxhighlight lang="lua">
addEventHandler("onClientPedsProcessed", root, function()
    -- Left
    setElementBoneRotation(localPlayer, 32, 26.574, 61.3375, 59.2065)
    setElementBoneRotation(localPlayer, 33, 27.844, 15.364, 46.406)
    setElementBoneRotation(localPlayer, 34, -81.0185, 342.875, 326.118)
    -- Right
    setElementBoneRotation(localPlayer, 22, 338.839, 53.4935, 298.452)
    setElementBoneRotation(localPlayer, 23, 307.687, 22.11, 313.594)
    setElementBoneRotation(localPlayer, 24, 96.0475, 357.883, 56.739)


==Warning==
    updateElementRpHAnim(localPlayer)
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'''.
end)
 
</syntaxhighlight>
As a result, this event may cause severe lag and/or even crashes if not used cautiously.


==See Also==
==See Also==

Latest revision as of 17:58, 1 June 2025

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

[[|link=|]] 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.

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/shoot, use toggleControl to disable them.

addEventHandler("onClientPedsProcessed", root, function()
    -- Left
    setElementBoneRotation(localPlayer, 32, 26.574, 61.3375, 59.2065)
    setElementBoneRotation(localPlayer, 33, 27.844, 15.364, 46.406)
    setElementBoneRotation(localPlayer, 34, -81.0185, 342.875, 326.118)
    -- Right
    setElementBoneRotation(localPlayer, 22, 338.839, 53.4935, 298.452)
    setElementBoneRotation(localPlayer, 23, 307.687, 22.11, 313.594)
    setElementBoneRotation(localPlayer, 24, 96.0475, 357.883, 56.739)

    updateElementRpHAnim(localPlayer)
end)

See Also

Game Processing Order

Other client events


Client event functions