コード例 #1
0
ファイル: Vehicle.cs プロジェクト: vladyslavkotyk/client
        public async Task <Ped> CreatePedOnSeat(VehicleSeat seat, Model model, RelationshipGroup type)
        {
            if (seat <= VehicleSeat.None)
            {
                return(null);
            }

            if (!IsSeatFree(seat))
            {
                return(null);
            }

            await model.LoadToMemoryNow();

            Pointer pedPtr = typeof(int);

            if (seat == VehicleSeat.Driver)
            {
                Function.Call(Natives.CREATE_CHAR_INSIDE_CAR, m_handle, (int)type, model.Hash, pedPtr);
            }
            else
            {
                Function.Call(Natives.CREATE_CHAR_AS_PASSENGER, m_handle, (int)type, model.Hash, (int)seat, pedPtr);
            }

            model.AllowDisposeFromMemory();

            if ((int)pedPtr == 0)
            {
                return(null);
            }

            return(ObjectCache <Ped> .Get((int)pedPtr));
        }
コード例 #2
0
        public static async Task <GameObject> CreateObject(Model Model, Vector3 Position)
        {
            if (!await Model.LoadToMemoryNow())
            {
                return(null);
            }
            Pointer obj = typeof(int);

            Function.Call(Natives.CREATE_OBJECT, Model.Hash, Position.X, Position.Y, Position.Z, obj, true);
            Model.AllowDisposeFromMemory();
            if ((int)obj == 0)
            {
                return(null);
            }
            return(ObjectCache <GameObject> .Get((int)obj));
        }
コード例 #3
0
ファイル: Pickup.cs プロジェクト: vladyslavkotyk/client
        public static async Task <Pickup> CreatePickup(Vector3 position, Model model, PickupType type)
        {
            if (!await model.LoadToMemoryNow())
            {
                return(null);
            }

            Pointer res = typeof(int);

            Function.Call(Natives.CREATE_PICKUP, model.Hash, (int)type, position.X, position.Y, position.Z, res, false);
            model.AllowDisposeFromMemory();

            if ((int)res == 0)
            {
                return(null);
            }

            return(ObjectCache <Pickup> .Get((int)res));
        }
コード例 #4
0
ファイル: Pickup.cs プロジェクト: vladyslavkotyk/client
        public static async Task <Pickup> CreateWeaponPickup(Vector3 position, Weapons weapon, int ammo)
        {
            Model model = Model.GetWeaponModel(weapon);

            if (!await model.LoadToMemoryNow())
            {
                return(null);
            }

            Pointer res = typeof(int);

            Function.Call(Natives.CREATE_PICKUP_WITH_AMMO, model.Hash, (int)PickupType.Weapon, ammo, position.X, position.Y, position.Z, res);

            if ((int)res == 0)
            {
                return(null);
            }

            return(ObjectCache <Pickup> .Get((int)res));
        }
コード例 #5
0
        public static async Task <Vehicle> CreateVehicle(Model model, Vector3 position)
        {
            if (!model.IsVehicle)
            {
                return(null);
            }

            if (!await model.LoadToMemoryNow())
            {
                return(null);
            }

            Pointer carPtr = typeof(int);

            Function.Call(Natives.CREATE_CAR, model.Hash, position.X, position.Y, position.Z, carPtr, true);
            model.AllowDisposeFromMemory();

            if ((int)carPtr == 0)
            {
                return(null);
            }

            return(ObjectCache <Vehicle> .Get((int)carPtr));
        }
コード例 #6
0
        public static async Task <Ped> CreatePed(Model model, Vector3 position, RelationshipGroup type)
        {
            if (!model.IsPed)
            {
                return(null);
            }

            if (!await model.LoadToMemoryNow())
            {
                return(null);
            }

            Pointer pedPtr = typeof(int);

            Function.Call(Natives.CREATE_CHAR, (int)type, model.Hash, position.X, position.Y, position.Z, pedPtr, true);
            model.AllowDisposeFromMemory();

            if ((int)pedPtr == 0)
            {
                return(null);
            }

            return(ObjectCache <Ped> .Get((int)pedPtr));
        }