Skip to content

players.playAnimation

Plays an animation on a player, seen by everyone near them.

players.playAnimation(player: PlayerTarget, animationGroup: string, animationName: string, loop?: boolean): Promise<ActionResult>
Name Type Description
player PlayerTarget The player, or their ID.
animationGroup string GTA:SA’s animation group, up to 24 characters; all of them on Animations.
animationName string The animation in that group, up to 32 characters.
loop boolean Optional. true repeats it until stopAnimation; the default false plays it once.

A promise of an ActionResult: applied once the player’s game has carried it out, rejected with a code, or timeout after five seconds without an answer.

gamemodes/my-mode.ts
import { commands, players } from "nativemp";
commands.register("walk", async (player) => {
await players.playAnimation(player, "player", "walk_player", true);
});

A captured Player keeps this effect bound to its connection across awaits; see Async handlers.