Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.07 KB | None | 0 0
  1. using System;
  2. using System.Threading.Tasks;
  3. using GTANetworkAPI;
  4. using VMP_CNR.Module.Players.Buffs;
  5. using VMP_CNR.Module.Players.Db;
  6. using VMP_CNR.Module.Players.PlayerAnimations;
  7.  
  8. namespace VMP_CNR.Module.Items.Scripts
  9. {
  10.     public static partial class ItemScript
  11.     {
  12.         public static bool joint(DbPlayer iPlayer, ItemModel ItemData)
  13.         {
  14.             if (iPlayer.Player.IsInVehicle)
  15.             {
  16.                 return false;
  17.             }
  18.  
  19.             bool antiinterrupt = false;
  20.             if (iPlayer.HasData("disableAnim"))
  21.             {
  22.                 antiinterrupt = Convert.ToBoolean(iPlayer.GetData("disableAnim"));
  23.             }
  24.  
  25.             if (antiinterrupt)
  26.             {
  27.                 return false;
  28.             }
  29.  
  30.             Task.Run(async () =>
  31.             {
  32.                 iPlayer.PlayAnimation( (int)(AnimationFlags.Loop | AnimationFlags.AllowPlayerControl), Main.AnimationList["joint_start"].Split()[0], Main.AnimationList["joint_start"].Split()[1]);
  33.                 iPlayer.Player.TriggerEvent("freezePlayer", true);
  34.                 await Task.Delay(8000);
  35.                 iPlayer.PlayAnimation( (int)(AnimationFlags.Loop | AnimationFlags.AllowPlayerControl), Main.AnimationList["joint_end"].Split()[0], Main.AnimationList["joint_end"].Split()[1]);
  36.                 await Task.Delay(2500);
  37.                 iPlayer.Player.TriggerEvent("freezePlayer", false);
  38.                 NAPI.Player.StopPlayerAnimation(iPlayer.Player);
  39.                 int actArmor = NAPI.Player.GetPlayerArmor(iPlayer.Player);
  40.                 int jointBuff = 20;
  41.                 int newArmor = 0;
  42.                 int maxArmor = 80;
  43.                
  44.                 if(actArmor >= maxArmor)
  45.                     newArmor = actArmor;
  46.                 else if(actArmor >= maxArmor - jointBuff)
  47.                     newArmor = maxArmor;
  48.                 else
  49.                     newArmor = actArmor + 20;
  50.                
  51.                 NAPI.Player.SetPlayerArmor(iPlayer.Player, newArmor);
  52.             });
  53.  
  54.             /*Altes System von Jeff - leider verbuggt
  55.             iPlayer.SetJointBuffs();
  56.             iPlayer.IncreasePlayerDrugInfection();
  57.             */
  58.             // RefreshInventory
  59.             return true;
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement