Exemplo n.º 1
0
		public static Prop CreatePropNoOffset(Model model, Vector3 position, bool dynamic)
		{
			if (!model.Request(1000))
			{
				return null;
			}

			return new Prop(Function.Call<int>(Hash.CREATE_OBJECT_NO_OFFSET, model.Hash, position.X, position.Y, position.Z, 1, 1, dynamic));
		}
Exemplo n.º 2
0
		public static Vehicle CreateVehicle(Model model, Vector3 position, float heading = 0f)
		{
			if (!model.Request(1000))
			{
				return null;
			}

			return new Vehicle(Function.Call<int>(Hash.CREATE_VEHICLE, model.Hash, position.X, position.Y, position.Z, heading, false, false));
		}
Exemplo n.º 3
0
 public static Vehicle CreateVehicle(Model model, Vector3 position, float heading = 0f)
 {
     if (!model.IsVehicle || !model.Request(0x3e8))
     {
         return(null);
     }
     InputArgument[] arguments = new InputArgument[] { model.Hash, position.X, position.Y, position.Z, heading, false, false };
     return(new Vehicle(Function.Call <int>(Hash.CREATE_VEHICLE, arguments)));
 }
Exemplo n.º 4
0
		public static Ped CreatePed(Model model, Vector3 position, float heading = 0f, int type = 26)
		{
			if (!model.Request(1000))
			{
				return null;
			}

			return new Ped(Function.Call<int>(Hash.CREATE_PED, type, model.Hash, position.X, position.Y, position.Z, heading, false, false));
		}
Exemplo n.º 5
0
 public static Prop CreatePropNoOffset(Model model, Vector3 position, bool dynamic)
 {
     if (!model.Request(0x3e8))
     {
         return(null);
     }
     InputArgument[] arguments = new InputArgument[] { model.Hash, position.X, position.Y, position.Z, 1, 1, dynamic };
     return(new Prop(Function.Call <int>(Hash.CREATE_OBJECT_NO_OFFSET, arguments)));
 }
Exemplo n.º 6
0
 public static Ped CreatePed(Model model, Vector3 position, float heading = 0f)
 {
     if (!model.IsPed || !model.Request(0x3e8))
     {
         return(null);
     }
     InputArgument[] arguments = new InputArgument[] { 0x1a, model.Hash, position.X, position.Y, position.Z, heading, false, false };
     return(new Ped(Function.Call <int>(Hash.CREATE_PED, arguments)));
 }
Exemplo n.º 7
0
        public static Pickup CreatePickup(PickupType type, Vector3 position, Model model, int value)
        {
            if (!model.Request(0x3e8))
            {
                return(null);
            }
            InputArgument[] arguments = new InputArgument[] { type, position.X, position.Y, position.Z, 0, value, true, model.Hash };
            int             handle    = Function.Call <int>(Hash.CREATE_PICKUP, arguments);

            return((handle != 0) ? new Pickup(handle) : null);
        }
Exemplo n.º 8
0
 public bool ChangeModel(Model model)
 {
     if (!model.IsInCdImage || (!model.IsPed || !model.Request(0x3e8)))
     {
         return(false);
     }
     InputArgument[] arguments = new InputArgument[] { this.Handle, model.Hash };
     Function.Call(Hash.SET_PLAYER_MODEL, arguments);
     model.MarkAsNoLongerNeeded();
     return(true);
 }
Exemplo n.º 9
0
        public Ped CreatePedOnSeat(VehicleSeat seat, Model model)
        {
            if (!IsSeatFree(seat))
            {
                throw new ArgumentException("The VehicleSeat selected was not free", "seat");
            }
            if (!model.IsPed || !model.Request(1000))
            {
                return(null);
            }

            return(new Ped(Function.Call <int>(Hash.CREATE_PED_INSIDE_VEHICLE, Handle, 26, model.Hash, seat, 1, 1)));
        }
Exemplo n.º 10
0
 public static Prop CreateProp(Model model, Vector3 position, bool dynamic, bool placeOnGround)
 {
     if (!model.Request(0x3e8))
     {
         return(null);
     }
     if (placeOnGround)
     {
         position.Z = GetGroundHeight(position);
     }
     InputArgument[] arguments = new InputArgument[] { model.Hash, position.X, position.Y, position.Z, 1, 1, dynamic };
     return(new Prop(Function.Call <int>(Hash.CREATE_OBJECT, arguments)));
 }
Exemplo n.º 11
0
        public bool ChangeModel(Model model)
        {
            if (!model.IsInCdImage || !model.IsPed || !model.Request(1000))
            {
                return(false);
            }

            Function.Call(Hash.SET_PLAYER_MODEL, Handle, model.Hash);

            model.MarkAsNoLongerNeeded();

            return(true);
        }
Exemplo n.º 12
0
		public static Prop CreateProp(Model model, Vector3 position, bool dynamic, bool placeOnGround)
		{
			if (!model.Request(1000))
			{
				return null;
			}

			if (placeOnGround)
			{
				position.Z = GetGroundHeight(position);
			}

			return new Prop(Function.Call<int>(Hash.CREATE_OBJECT, model.Hash, position.X, position.Y, position.Z, 1, 1, dynamic));
		}
Exemplo n.º 13
0
		public static Prop CreateAmbientPickup(PickupType type, Vector3 position, Model model, int value)
		{
			if (!model.Request(1000))
			{
				return null;
			}

			int handle = Function.Call<int>(Hash.CREATE_AMBIENT_PICKUP, type, position.X, position.Y, position.Z, 0, value, model.Hash, false, true);

			if (handle == 0)
			{
				return null;
			}

			return new Prop(handle);
		}
Exemplo n.º 14
0
		public static Pickup CreatePickup(PickupType type, Vector3 position, Vector3 rotation, Model model, int value)
		{
			if (!model.Request(1000))
			{
				return null;
			}

			int handle = Function.Call<int>(Hash.CREATE_PICKUP_ROTATE, type, position.X, position.Y, position.Z, rotation.X, rotation.Y, rotation.Z, 0, value, 2, true, model.Hash);

			if (handle == 0)
			{
				return null;
			}

			return new Pickup(handle);
		}
Exemplo n.º 15
0
        public static Prop CreateAmbientPickup(PickupType type, Vector3 position, Model model, int value)
        {
            if (!model.Request(0x3e8))
            {
                return(null);
            }
            InputArgument[] arguments = new InputArgument[9];
            arguments[0] = type;
            arguments[1] = position.X;
            arguments[2] = position.Y;
            arguments[3] = position.Z;
            arguments[4] = 0;
            arguments[5] = value;
            arguments[6] = model.Hash;
            arguments[7] = false;
            arguments[8] = true;
            int handle = Function.Call <int>(Hash.CREATE_AMBIENT_PICKUP, arguments);

            return((handle != 0) ? new Prop(handle) : null);
        }
Exemplo n.º 16
0
        public static Pickup CreatePickup(PickupType type, Vector3 position, Vector3 rotation, Model model, int value)
        {
            if (!model.Request(0x3e8))
            {
                return(null);
            }
            InputArgument[] arguments = new InputArgument[12];
            arguments[0]  = type;
            arguments[1]  = position.X;
            arguments[2]  = position.Y;
            arguments[3]  = position.Z;
            arguments[4]  = rotation.X;
            arguments[5]  = rotation.Y;
            arguments[6]  = rotation.Z;
            arguments[7]  = 0;
            arguments[8]  = value;
            arguments[9]  = 2;
            arguments[10] = true;
            arguments[11] = model.Hash;
            int handle = Function.Call <int>(Hash.CREATE_PICKUP_ROTATE, arguments);

            return((handle != 0) ? new Pickup(handle) : null);
        }
Exemplo n.º 17
0
    public AirDropMod()
    {
        Tick += OnTick;

        Blip AirDrop1Blip = World.CreateBlip(LOSSANTOSSQUARE, 2);
        {
            AirDrop1Blip.Sprite = BlipSprite.CrateDrop;
            AirDrop1Blip.Scale  = 100f;
        }

        int objectHash = Function.Call <int>(Hash.GET_HASH_KEY, "prop_crashed_heli");

        GTA.Model objectModel = new GTA.Model(objectHash);
        if (!objectModel.IsLoaded)
        {
            objectModel.Request(500);
            while (!objectModel.IsLoaded)
            {
                Wait(0);
            }
        }
        Function.Call(Hash.CREATE_OBJECT, objectModel, 194.9678f, -933.614f, 30.68681f, false, true, false);
        objectModel.MarkAsNoLongerNeeded();
    }
Exemplo n.º 18
0
                /// <summary>
                /// Set to specified Model
                /// </summary>
                /// <param name="modelHash">Model hash</param>
                /// <param name="modelName">Name of the model</param>
                public static void SetModel(int modelHash, string modelName)
                {
                    GTA.Model m = new GTA.Model(modelHash);
                    m.Request();

                    if (m.IsInCdImage && m.IsValid)
                    {
                        while (!m.IsLoaded) Script.Wait(0);

                        int? vehicle = null;
                        if (Game.Player.Character.IsInVehicle())
                        {
                            vehicle = Game.Player.Character.CurrentVehicle.Handle;
                        }

                        WeaponSet set = Weapon.GetCurrentWeaponSet();

                        Function.Call(Hash.SET_PLAYER_MODEL, Game.Player.Handle, m.Hash);
                        Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character.Handle);
                        if (!string.IsNullOrEmpty(modelName))
                        {
                            Utils.ShowNotificationAboveMap(string.Format(GlobalConst.Message.PLAYER_MODEL_SET, modelName));
                        }
                        Script.Wait(0);

                        if (vehicle.HasValue)
                        {
                            Function.Call(Hash.SET_PED_INTO_VEHICLE, Game.Player.Character.Handle, vehicle, -1);
                        }

                        Weapon.ApplyWeaponSet(set);

                        Script.Wait(SET_MODEL_WAIT);
                        m.MarkAsNoLongerNeeded();
                    }
                }