Use new force player anim util for tazer

This commit is contained in:
Vortrex
2022-01-09 05:29:24 -06:00
parent 2252388a68
commit c08bade492

View File

@@ -21,19 +21,12 @@ function tazePlayer(client) {
let animationId = getAnimationFromParams("tazed"); let animationId = getAnimationFromParams("tazed");
if(animationId != false) { if(animationId != false) {
forcePedAnimation(client.player, animationId); forcePlayerPlayAnimation(client, animationId);
getPlayerData(client).currentAnimation = animationId;
getPlayerData(client).currentAnimationPositionOffset = toVector3(0.0, 0.0, 0.0);
getPlayerData(client).currentAnimationPositionReturnTo = getPlayerPosition(client);
getPlayerData(client).animationStart = getCurrentUnixTimestamp();
getPlayerData(client).animationForced = true;
} }
setTimeout(function() { setTimeout(function() {
unTazePlayer(client); unTazePlayer(client);
doActionToNearbyPlayers(client, `The tazer effect wears off`); doActionToNearbyPlayers(client, `The tazer effect wears off`);
}, getGlobalConfig().tazerEffectDuration); }, getGlobalConfig().tazerEffectDuration);
} }
@@ -45,8 +38,7 @@ function unTazePlayer(client) {
setPlayerControlState(client, true); setPlayerControlState(client, true);
setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo); setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo);
makePedStopAnimation(getPlayerData(client).ped); makePedStopAnimation(getPlayerData(client).ped);
setPlayerMouseCameraState(client, false);
getPlayerData(client).forcedPedAnimation = -1;
} }
// =========================================================================== // ===========================================================================