Advertisement
Guest User

FiveM Deadline OnTick

a guest
Mar 10th, 2018
613
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.14 KB | None | 0 0
  1.         public async Task OnTick()
  2.         {
  3.             if (Function.Call<bool>(Hash.HAS_STREAMED_TEXTURE_DICT_LOADED, "Deadline"))
  4.             {
  5.                 if (Game.PlayerPed.IsSittingInVehicle())
  6.                 {
  7.                     if (!Function.Call<bool>(Hash._GET_SCREEN_EFFECT_IS_ACTIVE, "DeadlineNeon"))
  8.                     {
  9.                         Function.Call(Hash._START_SCREEN_EFFECT, "DeadlineNeon", 0, 1);
  10.                     }
  11.                     Vehicle v = Game.PlayerPed.CurrentVehicle;
  12.                     int index = Function.Call<int>(Hash.GET_ENTITY_BONE_INDEX_BY_NAME, v.Handle, "wheel_lr");
  13.                     Vector3 poz = Function.Call<Vector3>(Hash.GET_WORLD_POSITION_OF_ENTITY_BONE, v.Handle, index);
  14.                     //World.DrawMarker(MarkerType.DebugSphere, poz, Vector3.Zero, Vector3.Zero, Vector3.One * 0.4f, Color.FromArgb(255, 0, 0));
  15.  
  16.  
  17.                     var currentpos = Game.PlayerPed.CurrentVehicle.Position;
  18.                     var oldArray = posList;
  19.                     Array.Copy(oldArray, 0, posList, 1, 99);
  20.                     posList[0] = new Vector4(currentpos, Game.PlayerPed.CurrentVehicle.Rotation.Y);
  21.                     for (int i = 0; i < 99; i++)
  22.                     {
  23.                         //Debug.WriteLine(i.ToString());
  24.                         Vector3 pos = new Vector3(posList[i].X, posList[i].Y, posList[i].Z);
  25.                         float rot = MathUtil.DegreesToRadians(posList[i].W);
  26.                         Vector3 pos2 = new Vector3(posList[i + 1].X, posList[i + 1].Y, posList[i + 1].Z);
  27.                         float rot2 = MathUtil.DegreesToRadians(posList[i + 1].W);
  28.  
  29.                         Vector3 ul = pos + new Vector3(0f, 0f, 0.4f);
  30.                         Vector3 ur = pos2 + new Vector3(0f, 0f, 0.4f);
  31.                         Vector3 bl = pos + new Vector3(0f, 0f, -0.2f);
  32.                         Vector3 br = pos2 + new Vector3(0f, 0f, -0.2f);
  33.                         var alpha = 175;
  34.                         Function.Call((Hash)0x358BCCE967D10BA5, ur, bl, br, 24, 202, 230, alpha, "Deadline", "Deadline_Trail_01", 0f, 1f, 0f, 0f, 0f, 0f, 1f, 0f, 1f);
  35.                         Function.Call((Hash)0x358BCCE967D10BA5, br, bl, ur, 24, 202, 230, alpha, "Deadline", "Deadline_Trail_01", 0f, 0f, 1f, 1f, 0f, 1f, 1f, 1f, 1f);
  36.                         Function.Call((Hash)0x358BCCE967D10BA5, ur, ul, bl, 24, 202, 230, alpha, "Deadline", "Deadline_Trail_01", 0f, 0f, 1f, 1f, 0f, 1f, 1f, 1f, 1f);
  37.                         Function.Call((Hash)0x358BCCE967D10BA5, ul, ur, bl, 24, 202, 230, alpha, "Deadline", "Deadline_Trail_01", 0f, 0f, 1f, 1f, 0f, 1f, 1f, 1f, 1f);
  38.  
  39.                     }
  40.                 }
  41.                 else
  42.                 {
  43.                     if (Function.Call<bool>(Hash._GET_SCREEN_EFFECT_IS_ACTIVE, "DeadlineNeon"))
  44.                     {
  45.                         Function.Call(Hash._STOP_SCREEN_EFFECT, "DeadlineNeon");
  46.                     }
  47.                 }
  48.             }
  49.             else
  50.             {
  51.                 Function.Call(Hash.REQUEST_STREAMED_TEXTURE_DICT, "Deadline", true);
  52.             }
  53.  
  54.             await Task.FromResult(0);
  55.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement