Advertisement
LostProphet

AttachFootTest

Aug 12th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1. using GTA;
  2.  
  3. namespace SpeechCommands
  4. {
  5.     class AttachFootTest : Script
  6.     {
  7.         private GTA.Object objectToAttach = null;
  8.         private Bone boneToAttatch = Bone.RightFoot;
  9.  
  10.         public AttachFootTest()
  11.         {
  12.             this.BindConsoleCommand("GetStuck", this.Command_GetStuck);
  13.             this.BindConsoleCommand("StopTest", this.Command_StopTest);
  14.         }
  15.  
  16.         private void Command_GetStuck(ParameterCollection args)
  17.         {
  18.             this.objectToAttach = World.CreateObject("OBJECT_NAME_HERE", Game.LocalPlayer.Character.GetBonePosition(this.boneToAttatch).Around(2f));
  19.  
  20.             if (Game.Exists(this.objectToAttach) && (Game.LocalPlayer.Character.Position.DistanceTo(this.objectToAttach.Position) < 3f))
  21.             {
  22.                 this.objectToAttach.FreezePosition = true;
  23.                 this.objectToAttach.AttachToPed(Game.LocalPlayer.Character, this.boneToAttatch, Vector3.Zero, Vector3.Zero);
  24.             }
  25.         }
  26.  
  27.         private void Command_StopTest(ParameterCollection args)
  28.         {
  29.             if (Game.Exists(this.objectToAttach))
  30.             {
  31.                 this.objectToAttach.Detach();
  32.                 this.objectToAttach.Delete();
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement