Advertisement
TheChilliPL

My code

Jul 4th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.40 KB | None | 0 0
  1. using GTA;
  2. using System;
  3. using System.Windows.Forms;
  4.  
  5. public class Modification : Script
  6. {
  7.     public Modification()
  8.     {
  9.         Tick += OnTick;
  10.         KeyDown += OnKeyDown;
  11.         KeyUp += OnKeyUp;
  12.  
  13.         Interval = 10;
  14.     }
  15.  
  16.     // Benches coords
  17.     GTA.Math.Vector3[] weightBenches = new GTA.Math.Vector3[] {
  18.             new GTA.Math.Vector3(-1201.322f, -1574.971f, 4.074069f)
  19.         };
  20.  
  21.     // Benches rotation
  22.     float[] weightBenchesR = new float[] {
  23.             180
  24.         };
  25.  
  26.     float maxDistance = 2f;
  27.  
  28.     void OnTick(object sender, EventArgs e)
  29.     {
  30.  
  31.     }
  32.  
  33.     void OnKeyDown(object sender, KeyEventArgs e)
  34.     {
  35.        
  36.     }
  37.  
  38.     void OnKeyUp(object sender, KeyEventArgs e)
  39.     {
  40.         Player player = Game.Player;
  41.         Ped playerped = player.Character;
  42.         //UI.Notify(player.Position.ToString());
  43.         if (e.KeyCode == Keys.L)
  44.         {
  45.             //Game.FadeScreenOut(1000);
  46.             //player.CanControlCharacter = false;
  47.             //Wait(1000);
  48.             //playerped.Task.ClearAllImmediately();
  49.             //playerped.Task.StartScenario("WORLD_HUMAN_PUSH_UPS", playerped.Position);
  50.             //Wait(100);
  51.             //player.CanControlCharacter = true;
  52.             //Game.FadeScreenIn(1000);
  53.             for(int i = 0; i < weightBenches.Length; i++)
  54.             {
  55.                 if(weightBenches[i].DistanceTo(playerped.Position) < maxDistance)
  56.                 {
  57.                     Animation("PROP_HUMAN_SEAT_MUSCLE_BENCH_PRESS", weightBenches[i], weightBenchesR[i]);
  58.                 }
  59.             }
  60.         } else if(e.KeyCode == Keys.K)
  61.         {
  62.             playerped.Task.ClearAll();
  63.         } else if(e.KeyCode == Keys.R)
  64.         {
  65.             // Just for check coords and rotation
  66.             UI.Notify(playerped.Rotation);
  67.             UI.ShowSubtitle(playerped.Position.ToString());
  68.         }
  69.     }
  70.  
  71.     void Animation(String scenario, GTA.Math.Vector3 position, float rotation)
  72.     {
  73.         Player player = Game.Player;
  74.         Ped playerped = player.Character;
  75.         Game.FadeScreenOut(1000);
  76.         player.CanControlCharacter = false;
  77.         Wait(1000);
  78.         playerped.Task.ClearAllImmediately();
  79.         playerped.Task.StartScenario(scenario, position);
  80.         playerped.Heading = rotation;
  81.         Wait(100);
  82.         player.CanControlCharacter = true;
  83.         Game.FadeScreenIn(1000);
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement