diff --git a/src/main/server/player/animation.ts b/src/main/server/player/animation.ts index fcdea2cfa..ecaff873a 100644 --- a/src/main/server/player/animation.ts +++ b/src/main/server/player/animation.ts @@ -9,37 +9,63 @@ export function useAnimation(player: alt.Player) { player.clearTasks(); } - function playInfinite(dict: string, name: string, flags: number) { + function playInfinite( + dict: string, + name: string, + flags: number, + blendInDuration: number = 8.0, + blendOutDuration: number = 8.0, + playBackRate: number = 1.0, + ) { if (!player || !player.valid) { return; } - player.playAnimation(dict, name, 8.0, 8.0, -1, flags, 1.0, false, false, false); + player.playAnimation( + dict, + name, + blendInDuration, + blendOutDuration, + -1, + flags, + playBackRate, + false, + false, + false, + ); } async function playFinite( dict: string, name: string, flags: number, - timeoutInMs: number, - doNotClear = false + blendInDuration: number = 8.0, + blendOutDuration: number = 8.0, + durationInMs: number = 1000, + playBackRate: number = 1.0, + doNotClear: boolean = false, ): Promise { if (!player || !player.valid) { return; } - if (timeoutInMs <= 0) { - timeoutInMs = 100; - } + player.playAnimation( + dict, + name, + blendInDuration, + blendOutDuration, + durationInMs, + flags, + playBackRate, + false, + false, + false, + ); - player.playAnimation(dict, name, 8.0, 8.0, -1, flags, 1.0, false, false, false); - await alt.Utils.wait(timeoutInMs); - - if (doNotClear) { - return; + if (!doNotClear) { + await alt.Utils.wait(durationInMs); + clear(); } - - clear(); } return {