PlayPlayerAnimation

From GTA Network Wiki
Jump to: navigation, search

PlayPlayerAnimation
Server-Side Function

utilities-terminal.png Server-Side csharp.png C#

Function Description

Syntax

void NAPI.Player.PlayPlayerAnimation(Client player, int flag, string animDict, string animName, float speed = 8f);

Required arguments

  • player: parameter input should be in Client type.
  • flag: parameter input should be in int type.
  • animDict: parameter input should be in string type.
  • animName: parameter input should be in string type.

Optional arguments

  • speed: parameter input should be in float type.

Animation flags

These flags can be used with the flag parameter. To use them you need to cast the flags to an int.

[Flags]
public enum AnimationFlags
{
     Loop = 1 << 0,
     StopOnLastFrame = 1 << 1,
     OnlyAnimateUpperBody = 1 << 4,
     AllowPlayerControl = 1 << 5,
     Cancellable = 1 << 7
}


Usage example(s)

This animation will cuff the player and allow him to walk while being cuffed:

NAPI.Player.PlayPlayerAnimation(player, (int)(AnimationFlags.Loop | AnimationFlags.OnlyAnimateUpperBody | AnimationFlags.AllowPlayerControl), "mp_arresting", "idle");


Changelog

Version Description
1.0 Release.

References