Advertisement
Kieran_S0

anim

Feb 2nd, 2021
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.88 KB | None | 0 0
  1. using GTA;
  2. using GTA.Math;
  3. using GTA.Native;
  4. using System;
  5. using System.Windows.Forms;
  6.  
  7. namespace Sync_Scene_Prac
  8. {
  9.     public class Main : Script
  10.     {
  11.         Ped player = Game.Player.Character;
  12.         bool SceneActive = false;
  13.         int SceneIndex = -1;
  14.         int SceneID;
  15.         Prop Duffelbag;
  16.  
  17.         public Main()
  18.         {
  19.             Tick += onTick;
  20.             KeyDown += onKeyDown;
  21.         }
  22.         private void onTick(object sender, EventArgs e)
  23.         {
  24.             if (SceneActive)
  25.             {
  26.                 switch (SceneIndex)
  27.                 {
  28.                     case 0:
  29.                         {
  30.                             Function.Call(Hash.REQUEST_ANIM_DICT, "anim@heists@money_grab@duffel");
  31.  
  32.                             Model bagmodel = new Model("p_ld_heist_bag_01");
  33.                             bagmodel.Request(10000);
  34.                             if (bagmodel.IsValid && bagmodel.IsInCdImage)
  35.                             {
  36.                                 while (!bagmodel.IsLoaded) Script.Wait(50);
  37.                                 Duffelbag = World.CreateProp(bagmodel, player.Position, false, false);
  38.                             }
  39.                             SceneIndex = 10;
  40.                             break;
  41.                         }
  42.                     case 10:
  43.                         {
  44.                             SceneID = Function.Call<int>(Hash.CREATE_SYNCHRONIZED_SCENE, player.Position.X, player.Position.Y, player.Position.Z, player.Rotation.X, player.Rotation.Y, player.Rotation.Z, 2);
  45.                             Function.Call(Hash.TASK_SYNCHRONIZED_SCENE, player, SceneID, "anim@heists@money_grab@duffel", "exit", 1.0f, -1.0f, 3341, 16, 0x447a0000, 0);
  46.                             Function.Call(Hash.PLAY_SYNCHRONIZED_ENTITY_ANIM, Duffelbag, SceneID, "exit_bag", "anim@heists@money_grab@duffel", 1000, -1000, 0, 0x447a0000);
  47.                             SceneIndex = 20;
  48.                             break;
  49.                         }
  50.                     case 20:
  51.                         {
  52.                             if (Function.Call<float>(Hash.GET_SYNCHRONIZED_SCENE_PHASE, SceneID) > 0.999f)
  53.                             {
  54.                                 player.Task.ClearAll();
  55.                                 if (Duffelbag != null)
  56.                                 {
  57.                                     Duffelbag.Delete();
  58.                                 }
  59.                                 SceneIndex = -1;
  60.                                 SceneActive = false;
  61.                             }
  62.                             break;
  63.                         }
  64.                 }
  65.             }
  66.         }
  67.         private void onKeyDown(object sender, KeyEventArgs e)
  68.         {
  69.             if (e.KeyCode == Keys.D9)
  70.             {
  71.                 SceneActive = true;
  72.                 SceneIndex = 0;
  73.             }
  74.         }
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement