Skip to main content

Task::handsUp

Client-side function

JavaScript​

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);