Exemple #1
0
        public Rope(string player, int id, int entity1, int entity2, Vector3 offset1, Vector3 offset2, float length)
        {
            Player  = player;
            ID      = id;
            Entity1 = entity1;
            Entity2 = entity2;
            Offset1 = offset1;
            Offset2 = offset2;
            Length  = length;

            if (API.IsEntityAPed(Entity1))
            {
                _bone1      = Peds.GetClosestPedBoneToOffset(Entity1, Offset1);
                _boneIndex1 = API.GetEntityBoneIndexByName(Entity1, _bone1);
                Offset1     = Vector3.Zero;
            }

            if (API.IsEntityAPed(Entity2))
            {
                _bone2      = Peds.GetClosestPedBoneToOffset(Entity2, Offset2);
                _boneIndex2 = API.GetEntityBoneIndexByName(Entity2, _bone2);
                Offset2     = Vector3.Zero;
            }

            _handle = RopePool.AddRope();
            Attach();
            API.StartRopeWinding(_handle);
            API.RopeForceLength(_handle, length);
        }
Exemple #2
0
        public void Clear()
        {
            if (_handle == -1)
            {
                return;
            }

            API.DetachRopeFromEntity(_handle, Entity1);
            API.DetachRopeFromEntity(_handle, Entity2);
            RopePool.DeleteRope(ref _handle);
            _handle = -1;
        }