Add tazed anim + use new anim consts

This commit is contained in:
Vortrex
2022-01-06 13:33:11 -06:00
parent 0d0ad33ebc
commit 89c139288c
2 changed files with 184 additions and 136 deletions

View File

@@ -19,9 +19,19 @@ function tazePlayer(client) {
getPlayerData(client).pedState = VRR_PEDSTATE_TAZED;
setPlayerControlState(client, false);
let animationId = getAnimationFromParams("tazed");
forcePedAnimation(client.player, 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() {
unTazePlayer(client);
doActionToNearbyPlayers(client, `The tazer effect wears off`);
}, getGlobalConfig().tazerEffectDuration);
}
@@ -29,7 +39,12 @@ function tazePlayer(client) {
function unTazePlayer(client) {
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
setPlayerControlState(client, true);
setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo);
makePedStopAnimation(getPlayerData(client).ped);
setPlayerMouseCameraState(client, false);
getPlayerData(client).forcedPedAnimation = -1;
}
// ===========================================================================