Player::resetRagdollTimer: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{ClientsideJsFunction}}
{{JSContainer|


==Syntax==
The `resetRagdollTimer` function resets the ragdoll timer for the player, effectively extending the duration they remain in a ragdoll state. When `setToRagdoll` is called, the player enters a ragdoll (physics-based) state for a specified time. By calling `resetRagdollTimer` before the timer expires, you can reset the timer, allowing the player to continue in the ragdoll state for the original duration again.
<syntaxhighlight lang="javascript">player.resetRagdollTimer();</syntaxhighlight>
 
=== Required Arguments ===
This function is useful in scenarios where you want to dynamically control or extend the ragdoll effect based on gameplay events, without needing to call `setToRagdoll` repeatedly with new durations.
===Return value===
 
*'''Undefined'''
=== Required Params ===
==Example==
* None
 
=== Return Value ===
* '''Undefined''' – This function does not return a value.
 
== Syntax ==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
player.resetRagdollTimer();
</syntaxhighlight>
 
== Example ==
<syntaxhighlight lang="javascript">
// Example usage of resetRagdollTimer
 
// Make the player enter ragdoll state for 5 seconds
player.setToRagdoll(5000, 5000, 0, true, true, true);
 
// Wait less than 5 seconds before resetting the timer
setTimeout(() => {
    player.resetRagdollTimer(); // Resets the timer, adding another 5 seconds to the ragdoll state
    mp.gui.chat.push("Ragdoll timer reset!"); // Confirm action in chat
}, 3000); // Reset timer after 3 seconds, extending ragdoll state
</syntaxhighlight>
</syntaxhighlight>
==See also==
}}
== See Also ==
{{Player_function_c}}
{{Player_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 09:29, 2 November 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


The `resetRagdollTimer` function resets the ragdoll timer for the player, effectively extending the duration they remain in a ragdoll state. When `setToRagdoll` is called, the player enters a ragdoll (physics-based) state for a specified time. By calling `resetRagdollTimer` before the timer expires, you can reset the timer, allowing the player to continue in the ragdoll state for the original duration again.

This function is useful in scenarios where you want to dynamically control or extend the ragdoll effect based on gameplay events, without needing to call `setToRagdoll` repeatedly with new durations.

Required Params

  • None

Return Value

  • Undefined – This function does not return a value.

Syntax

player.resetRagdollTimer();

Example

// Example usage of resetRagdollTimer

// Make the player enter ragdoll state for 5 seconds
player.setToRagdoll(5000, 5000, 0, true, true, true); 

// Wait less than 5 seconds before resetting the timer
setTimeout(() => {
    player.resetRagdollTimer(); // Resets the timer, adding another 5 seconds to the ragdoll state
    mp.gui.chat.push("Ragdoll timer reset!"); // Confirm action in chat
}, 3000); // Reset timer after 3 seconds, extending ragdoll state


See Also