Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- const players = {};
- let ghost = false;
- players.animate = (player, animDict, animName, duration, flag, looped, stopOnLastFrame) => {
- if (!player || !mp.game.streaming.doesAnimDictExist(animDict)) { return; }
- if (!mp.game.streaming.hasAnimDictLoaded(animDict)) {
- mp.game.streaming.requestAnimDict(animDict);
- }
- while (!mp.game.streaming.hasAnimDictLoaded(animDict)) mp.game.wait(0);
- if (!player) { return; }
- player.taskPlayAnim(animDict, animName, 8.0, 1, Number(duration), Number(flag), 0, false, false, false);
- if (duration > 0) {
- setTimeout(() => {
- if (player) {
- player.clearTasks();
- player.clearTasksImmediately();
- player.stopAnimTask(animDict, animName, 0);
- }
- }, duration * 1000);
- }
- if (looped | stopOnLastFrame) { return -1; }
- return mp.game.entity.getEntityAnimDuration(animDict, animName);
- };
- players.walkingstyle = (player, style) => {
- if (!style) {
- player.resetMovementClipset(0.0);
- } else {
- if (!mp.game.streaming.hasClipSetLoaded(style)) {
- mp.game.streaming.requestClipSet(style);
- while (!mp.game.streaming.hasClipSetLoaded(style)) mp.game.wait(0);
- }
- player.setMovementClipset(style, 0.0);
- }
- };
- players.moodstyle = (player, animName) => {
- if (animName == null || animName == "") {
- player.clearFacialIdleAnimOverride();
- } else {
- mp.game.invoke("0xFFC24B988B938B38", player.handle, animName, 0);//SET_FACIAL_IDLE_ANIM_OVERRIDE
- }
- };
- players.ghostStatus = (status) => {
- this.ghost = status;
- };
- players.ghost = () => {
- if (!this.ghost) { return; }
- if (!mp.game.graphics.hasStreamedTextureDictLoaded("cs2_08_ghost")) {
- mp.game.graphics.requestStreamedTextureDict("cs2_08_ghost", true);
- }
- if (mp.game.graphics.hasStreamedTextureDictLoaded("cs2_08_ghost")) {
- let lPed = mp.players.local;
- let lVect = lPed.getOffsetFromInWorldCoords(-1.6, 8.0, 1.5);
- mp.game.graphics.setDrawOrigin(lVect.x, lVect.y, lVect.z, 0);
- mp.game.graphics.drawSprite("cs2_08_ghost", "cs1_10_generic01cs1_10_generic01_a", 0.5, 0.5, 1, 1, 0, 255, 255, 255, 255);
- }
- };
- exports = players;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement