56 lines
2.1 KiB
JavaScript
56 lines
2.1 KiB
JavaScript
// ===========================================================================
|
|
// Vortrex's Roleplay Resource
|
|
// https://github.com/VortrexFTW/gtac_roleplay
|
|
// ===========================================================================
|
|
// FILE: animation.js
|
|
// DESC: Provides animation functions and usage
|
|
// TYPE: Server (JavaScript)
|
|
// ===========================================================================
|
|
|
|
function initAnimationScript() {
|
|
logToConsole(LOG_DEBUG, "[VRR.Animation]: Initializing animation script ...");
|
|
logToConsole(LOG_DEBUG, "[VRR.Animation]: Animation script initialized!");
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function playPlayerAnimationCommand(command, params, client) {
|
|
if(areParamsEmpty(params)) {
|
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
|
return false;
|
|
}
|
|
|
|
let animationSlot = getAnimationFromParams(params);
|
|
|
|
if(!animationSlot) {
|
|
messagePlayerError(client, "That animation doesn't exist!");
|
|
return false;
|
|
}
|
|
|
|
getPlayerData(client).currentAnimation = animationSlot;
|
|
getPlayerData(client).animationStart = getCurrentUnixTimestamp();
|
|
//setEntityData(getPlayerData(client).ped, "vrr.animation", animationSlot, true);
|
|
makePedPlayAnimation(getPlayerData(client).ped, animationSlot);
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function showAnimationListCommand(command, params, client) {
|
|
let animList = getGameData().animations[getServerGame()].map(function(x) { return x[0]; });
|
|
|
|
let chunkedList = splitArrayIntoChunks(animList, 10);
|
|
|
|
messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Animation List ${getInlineChatColourByType("clanOrange")}===========================`);
|
|
|
|
for(let i in chunkedList) {
|
|
messagePlayerInfo(client, chunkedList[i].join(", "));
|
|
}
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function getAnimationData(animationSlot, gameId = getServerGame()) {
|
|
return getGameData().animations[gameId][animationSlot];
|
|
}
|
|
|
|
// ===========================================================================
|