Task::handsUp: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with " {{ClientsideJsFunction}} {{JSContainer| ===Required Params=== *'''ped:''' {{RageType|number}} *'''duration:''' {{RageType|number}} *'''facingPed:''' {{RageType|number}} *'''p3:''' {{RageType|number}} *'''p4:''' {{RageType|boolean}} ===Return value=== *''' {{RageType|void}} ''' ==Syntax== <syntaxhighlight lang="javascript"> mp.game.task.handsUp(ped, duration, facingPed, p3, p4) </syntaxhighlight> ==Example== <syntaxhighlight lang="javascript"> //todo </syntaxhighligh...")
 
No edit summary
 
Line 1: Line 1:
{{ClientsideJsFunction}} 
{{JSContainer| 


{{ClientsideJsFunction}}
===Explanation=== 
{{JSContainer|
The `mp.game.task.handsUp` function allows you to make a pedestrian (ped) raise their hands, simulating a surrender or defensive action. The duration parameter controls how long the ped will keep their hands raised, and the `facingPed` parameter defines which ped they will face while doing so. The `p4` boolean controls if the action can be interrupted by other tasks. 


===Required Params===
===Required Params===
*'''ped:''' {{RageType|number}}
*'''ped:''' {{RageType|number}} — The pedestrian (ped) performing the action. 
*'''duration:''' {{RageType|number}}
*'''duration:''' {{RageType|number}} — The duration (in milliseconds) for which the pedestrian will raise their hands. 
*'''facingPed:''' {{RageType|number}}
*'''facingPed:''' {{RageType|number}} — The ped that the first ped will face while raising their hands. 
*'''p3:''' {{RageType|number}}
*'''p3:''' {{RageType|number}} — An optional parameter related to task handling (usually set to 0). 
*'''p4:''' {{RageType|boolean}}
*'''p4:''' {{RageType|boolean}} — A boolean that determines whether the action can be interrupted by other tasks. 


===Return value===
===Return value===
*''' {{RageType|void}} '''
*'''{{RageType|void}}''' — This function does not return any value. 


==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
mp.game.task.handsUp(ped, duration, facingPed, p3, p4)
mp.game.task.handsUp(ped, duration, facingPed, p3, p4)
</syntaxhighlight>
</syntaxhighlight>


==Example==
==Example==
<syntaxhighlight lang="javascript">
This example makes the specified ped raise their hands for 5 seconds, facing another ped, with the default interrupt settings. 
//todo
 
<syntaxhighlight lang="javascript">
// Example to make a ped raise hands for 5 seconds facing another ped 
const ped = mp.players.local; 
const facingPed = mp.players.at(1); // Face the second player 
const duration = 5000; // 5 seconds 
mp.game.task.handsUp(ped.handle, duration, facingPed.handle, 0, false); 
</syntaxhighlight>
</syntaxhighlight>
}}
}}
==See also==
==See also==
{{Task_functions_c}}
{{Task_functions_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 16:59, 8 November 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


Explanation

The `mp.game.task.handsUp` function allows you to make a pedestrian (ped) raise their hands, simulating a surrender or defensive action. The duration parameter controls how long the ped will keep their hands raised, and the `facingPed` parameter defines which ped they will face while doing so. The `p4` boolean controls if the action can be interrupted by other tasks.

Required Params

  • ped: number — The pedestrian (ped) performing the action.
  • duration: number — The duration (in milliseconds) for which the pedestrian will raise their hands.
  • facingPed: number — The ped that the first ped will face while raising their hands.
  • p3: number — An optional parameter related to task handling (usually set to 0).
  • p4: boolean — A boolean that determines whether the action can be interrupted by other tasks.

Return value

  • 'void' — This function does not return any value.

Syntax

  
mp.game.task.handsUp(ped, duration, facingPed, p3, p4)

Example

This example makes the specified ped raise their hands for 5 seconds, facing another ped, with the default interrupt settings.

  
// Example to make a ped raise hands for 5 seconds facing another ped  
const ped = mp.players.local;  
const facingPed = mp.players.at(1); // Face the second player  
const duration = 5000; // 5 seconds  
mp.game.task.handsUp(ped.handle, duration, facingPed.handle, 0, false);


See also