Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2.  
  3. const players = {};
  4. let ghost = false;
  5.  
  6. players.animate = (player, animDict, animName, duration, flag, looped, stopOnLastFrame) => {
  7.     if (!player || !mp.game.streaming.doesAnimDictExist(animDict)) { return; }
  8.     if (!mp.game.streaming.hasAnimDictLoaded(animDict)) {
  9.         mp.game.streaming.requestAnimDict(animDict);
  10.     }
  11.  
  12.     while (!mp.game.streaming.hasAnimDictLoaded(animDict)) mp.game.wait(0);
  13.  
  14.     if (!player) { return; }
  15.  
  16.     player.taskPlayAnim(animDict, animName, 8.0, 1, Number(duration), Number(flag), 0, false, false, false);
  17.  
  18.     if (duration > 0) {
  19.         setTimeout(() => {
  20.             if (player) {
  21.                 player.clearTasks();
  22.                 player.clearTasksImmediately();
  23.                 player.stopAnimTask(animDict, animName, 0);
  24.             }
  25.         }, duration * 1000);
  26.     }
  27.     if (looped | stopOnLastFrame) { return -1; }
  28.     return mp.game.entity.getEntityAnimDuration(animDict, animName);
  29. };
  30.  
  31. players.walkingstyle = (player, style) => {
  32.     if (!style) {
  33.         player.resetMovementClipset(0.0);
  34.     } else {
  35.         if (!mp.game.streaming.hasClipSetLoaded(style)) {
  36.             mp.game.streaming.requestClipSet(style);
  37.             while (!mp.game.streaming.hasClipSetLoaded(style)) mp.game.wait(0);
  38.         }
  39.  
  40.         player.setMovementClipset(style, 0.0);
  41.     }
  42. };
  43.  
  44. players.moodstyle = (player, animName) => {
  45.     if (animName == null || animName == "") {
  46.         player.clearFacialIdleAnimOverride();
  47.     } else {
  48.         mp.game.invoke("0xFFC24B988B938B38", player.handle, animName, 0);//SET_FACIAL_IDLE_ANIM_OVERRIDE
  49.     }
  50. };
  51.  
  52. players.ghostStatus = (status) => {
  53.     this.ghost = status;
  54. };
  55.  
  56. players.ghost = () => {
  57.     if (!this.ghost) { return; }
  58.     if (!mp.game.graphics.hasStreamedTextureDictLoaded("cs2_08_ghost")) {
  59.         mp.game.graphics.requestStreamedTextureDict("cs2_08_ghost", true);
  60.     }
  61.  
  62.     if (mp.game.graphics.hasStreamedTextureDictLoaded("cs2_08_ghost")) {
  63.         let lPed = mp.players.local;
  64.         let lVect = lPed.getOffsetFromInWorldCoords(-1.6, 8.0, 1.5);
  65.         mp.game.graphics.setDrawOrigin(lVect.x, lVect.y, lVect.z, 0);
  66.         mp.game.graphics.drawSprite("cs2_08_ghost", "cs1_10_generic01cs1_10_generic01_a", 0.5, 0.5, 1, 1, 0, 255, 255, 255, 255);
  67.     }
  68. };
  69.  
  70.  
  71.  
  72. exports = players;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement