Use new force player anim util for tazer
This commit is contained in:
@@ -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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
Reference in New Issue
Block a user