Exemple #1
0
        public void SpawnCommand(Player sender, VehicleModelType model, IWorldService worldService)
        {
            var vehicle = worldService.CreateVehicle(model, sender.Position + Vector3.Up, 0, -1, -1);

            sender.PutInVehicle(vehicle.Entity);
            sender.SendClientMessage($"{model} spawned!");
        }
Exemple #2
0
        private void SpawnVehicleCommand(VehicleModelType model)
        {
            Random      rndColor = new Random();
            BaseVehicle v        = BaseVehicle.Create(model, new Vector3(this.Position.X + 5.0, this.Position.Y, this.Position.Z), 0.0f, rndColor.Next(0, 255), rndColor.Next(0, 255));

            this.PutInVehicle(v, 0);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            VehicleModelType vehicleModelType = db.VehicleModelTypes.Find(id);

            db.VehicleModelTypes.Remove(vehicleModelType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public VehicleModel(VehicleModelType model, int basePrice, float maxFuel, float fuelCons, int containerSize)
 {
     Model           = model;
     BasePrice       = basePrice;
     MaxFuel         = maxFuel;
     FuelConsumption = fuelCons;
     ContainerSize   = containerSize;
 }
Exemple #5
0
        /// <summary>
        ///     Returns an instance of <see cref="VehicleModelInfo" /> containing information about the given
        ///     <see cref="VehicleModelType" />.
        /// </summary>
        /// <param name="model">The <see cref="VehicleModelType" /> to find information about.</param>
        /// <returns>An instance of <see cref="VehicleModelInfo" /> containing information about the given VehicleModelType.</returns>
        public static VehicleModelInfo ForVehicle(VehicleModelType model)
        {
            if ((int)model < 400 || (int)model > 611)
            {
                throw new ArgumentOutOfRangeException("vehicle's model is non-existant");
            }

            return(VehicleModelInfos[(int)model - 400]);
        }
        /// <summary>
        ///     Creates a static <see cref="BaseVehicle" /> in the world.
        /// </summary>
        /// <param name="vehicletype">The model for the vehicle.</param>
        /// <param name="position">The coordinates for the vehicle.</param>
        /// <param name="rotation">The facing angle for the vehicle.</param>
        /// <param name="color1">The primary color ID.</param>
        /// <param name="color2">The secondary color ID.</param>
        /// <returns> The <see cref="BaseVehicle" /> created.</returns>
        public virtual BaseVehicle CreateStatic(VehicleModelType vehicletype, Vector3 position, float rotation,
                                                int color1,
                                                int color2)
        {
            var id = Internal.AddStaticVehicle((int)vehicletype, position.X, position.Y, position.Z, rotation, color1,
                                               color2);

            return(id == BaseVehicle.InvalidId ? null : BaseVehicle.FindOrCreate(id));
        }
Exemple #7
0
        public static void VehicleCommand(GtaPlayer player, VehicleModelType model)
        {
            player.SendClientMessage(Color.GreenYellow, "You have spawned a {0}", model);
            Console.WriteLine("Spawning a {0} {2} for {1}", model, player, (int)model);
            GtaVehicle vehicle = GtaVehicle.Create(model, player.Position + new Vector3(0, 0, 0.5f), player.Rotation.Z, -1,
                                                   -1);

            player.PutInVehicle(vehicle);
        }
 public ActionResult Edit([Bind(Include = "VehicleModelTypeID,VehicleModelTypeDescription")] VehicleModelType vehicleModelType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vehicleModelType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vehicleModelType));
 }
Exemple #9
0
        public static void CreateTmpVehicleForPlayer(Player sender, VehicleModelType vehicle)
        {
            var veh = Helper.CreateVehicle(sender.ActiveCharacter,
                                           ModelHelper.ModelForModelType(vehicle), sender.Position, sender.Angle,
                                           VehicleColor.BrighRed, VehicleColor.BrighRed, true);

            veh.Data.FuelConsumption = 0;
            veh.Health = 100000;
            sender.PutInVehicle(veh);
            veh.Engine = true;
        }
Exemple #10
0
        public static void SpawnCommand(BasePlayer player, VehicleModelType type)
        {
            var vehicle = BaseVehicle.Create(type, player.Position + Vector3.Up, player.Angle, -1, -1);

            player.PutInVehicle(vehicle);
            vehicle.GetDamageStatus(out var panels, out var doors, out var lights, out var tires);
            Console.WriteLine(panels.ToString());
            Console.WriteLine(doors.ToString());
            Console.WriteLine(lights.ToString());
            Console.WriteLine(tires.ToString());
        }
        /// <summary>
        ///     Creates a static <see cref="BaseVehicle" /> in the world.
        /// </summary>
        /// <param name="vehicletype">The model for the vehicle.</param>
        /// <param name="position">The coordinates for the vehicle.</param>
        /// <param name="rotation">The facing angle for the vehicle.</param>
        /// <param name="color1">The primary color ID.</param>
        /// <param name="color2">The secondary color ID.</param>
        /// <param name="respawnDelay">
        ///     The delay until the car is respawned without a driver in seconds. Using -1 will prevent the
        ///     vehicle from respawning.
        /// </param>
        /// <param name="addAlarm">If true, enables the vehicle to have a siren, providing the vehicle has a horn.</param>
        /// <returns> The <see cref="BaseVehicle" /> created.</returns>
        public virtual BaseVehicle CreateStatic(VehicleModelType vehicletype, Vector3 position, float rotation,
                                                int color1,
                                                int color2,
                                                int respawnDelay, bool addAlarm = false)
        {
            var id = Internal.AddStaticVehicleEx((int)vehicletype, position.X, position.Y, position.Z, rotation, color1,
                                                 color2,
                                                 respawnDelay, addAlarm);

            return(id == BaseVehicle.InvalidId ? null : BaseVehicle.FindOrCreate(id));
        }
        /// <summary>
        ///     Creates a static <see cref="BaseVehicle" /> in the world.
        /// </summary>
        /// <param name="vehicletype">The model for the vehicle.</param>
        /// <param name="position">The coordinates for the vehicle.</param>
        /// <param name="rotation">The facing angle for the vehicle.</param>
        /// <param name="color1">The primary color ID.</param>
        /// <param name="color2">The secondary color ID.</param>
        /// <param name="respawnDelay">
        ///     The delay until the car is respawned without a driver in seconds. Using -1 will prevent the
        ///     vehicle from respawning.
        /// </param>
        /// <param name="addAlarm">If true, enables the vehicle to have a siren, providing the vehicle has a horn.</param>
        /// <returns> The <see cref="BaseVehicle" /> created.</returns>
        public virtual BaseVehicle CreateStatic(VehicleModelType vehicletype, Vector3 position, float rotation,
            int color1,
            int color2,
            int respawnDelay, bool addAlarm = false)
        {
            var id = Internal.AddStaticVehicleEx((int) vehicletype, position.X, position.Y, position.Z, rotation, color1,
                color2,
                respawnDelay, addAlarm);

            return id == BaseVehicle.InvalidId ? null : BaseVehicle.FindOrCreate(id);
        }
        public ActionResult Create([Bind(Include = "VehicleModelTypeID,VehicleModelTypeDescription")] VehicleModelType vehicleModelType)
        {
            if (ModelState.IsValid)
            {
                db.VehicleModelTypes.Add(vehicleModelType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(vehicleModelType));
        }
Exemple #14
0
 private static void SpawnTmp(Player sender, VehicleModelType vehicle)
 {
     try
     {
         AdminHelper.VehicleSpawnTmp(sender, vehicle);
         Chat.AdminChat(sender, "Véhicule temporaire " + Constants.Chat.HIGHLIGHT + vehicle + Color.White + " crée.");
     }
     catch (Exception e)
     {
         Chat.ErrorChat(sender, e.Message);
     }
 }
        /// <summary>
        ///     Creates a <see cref="BaseVehicle" /> in the world.
        /// </summary>
        /// <param name="vehicletype">The model for the vehicle.</param>
        /// <param name="position">The coordinates for the vehicle.</param>
        /// <param name="rotation">The facing angle for the vehicle.</param>
        /// <param name="color1">The primary color ID.</param>
        /// <param name="color2">The secondary color ID.</param>
        /// <param name="respawnDelay">
        ///     The delay until the car is respawned without a driver in seconds. Using -1 will prevent the
        ///     vehicle from respawning.
        /// </param>
        /// <param name="addAlarm">If true, enables the vehicle to have a siren, providing the vehicle has a horn.</param>
        /// <returns> The <see cref="BaseVehicle" /> created.</returns>
        public virtual BaseVehicle Create(VehicleModelType vehicletype, Vector3 position, float rotation, int color1,
            int color2,
            int respawnDelay = -1, bool addAlarm = false)
        {
            var id = new[] {449, 537, 538, 569, 570, 590}.Contains((int) vehicletype)
                ? Internal.AddStaticVehicleEx((int) vehicletype, position.X, position.Y, position.Z, rotation, color1,
                    color2,
                    respawnDelay, addAlarm)
                : Internal.CreateVehicle((int) vehicletype, position.X, position.Y, position.Z, rotation, color1, color2,
                    respawnDelay, addAlarm);

            return id == BaseVehicle.InvalidId ? null : BaseVehicle.FindOrCreate(id);
        }
Exemple #16
0
 private static void Create(Player sender, Player target, VehicleModelType vehicle)
 {
     try
     {
         AdminHelper.VehicleCreate(sender, target, vehicle);
         Chat.AdminChat(sender, "Véhicule " + Constants.Chat.HIGHLIGHT + vehicle + Color.White + " crée pour " + Constants.Chat.USERNAME + target.Name + Color.White + " (" + target.Id + ").");
         Chat.ClientChat(target, Constants.Chat.USERNAME + sender.AccountData.Nickname + Color.White + " vous a créé le véhicule " + Constants.Chat.HIGHLIGHT + vehicle + Color.White + ".");
     }
     catch (Exception e)
     {
         Chat.ErrorChat(sender, e.Message);
     }
 }
        /// <summary>
        ///     Creates a <see cref="BaseVehicle" /> in the world.
        /// </summary>
        /// <param name="vehicletype">The model for the vehicle.</param>
        /// <param name="position">The coordinates for the vehicle.</param>
        /// <param name="rotation">The facing angle for the vehicle.</param>
        /// <param name="color1">The primary color ID.</param>
        /// <param name="color2">The secondary color ID.</param>
        /// <param name="respawnDelay">
        ///     The delay until the car is respawned without a driver in seconds. Using -1 will prevent the
        ///     vehicle from respawning.
        /// </param>
        /// <param name="addAlarm">If true, enables the vehicle to have a siren, providing the vehicle has a horn.</param>
        /// <returns> The <see cref="BaseVehicle" /> created.</returns>
        public virtual BaseVehicle Create(VehicleModelType vehicletype, Vector3 position, float rotation, int color1,
                                          int color2,
                                          int respawnDelay = -1, bool addAlarm = false)
        {
            var id = new[] { 449, 537, 538, 569, 570, 590 }.Contains((int)vehicletype)
                ? Internal.AddStaticVehicleEx((int)vehicletype, position.X, position.Y, position.Z, rotation, color1,
                                              color2,
                                              respawnDelay, addAlarm)
                : Internal.CreateVehicle((int)vehicletype, position.X, position.Y, position.Z, rotation, color1, color2,
                                         respawnDelay, addAlarm);

            return(id == BaseVehicle.InvalidId ? null : BaseVehicle.FindOrCreate(id));
        }
Exemple #18
0
        public static void OnSpawnVehicleCommand(BasePlayer sender, VehicleModelType model)
        {
            if (sender.Vehicle != null)
            {
                sender.SendClientMessage(Color.IndianRed, Messages.AlreadyInAVehicle);
                return;
            }

            var car = (Vehicle)BaseVehicle.Create(model, sender.Position + Vector3.One, sender.Angle, -1, -1, 600);

            car.Engine         = true;
            car.IsAdminSpawned = true;
            sender.PutInVehicle(car, 0);
        }
Exemple #19
0
        public static int VehicleCreate(Player sender, Player target, VehicleModelType vehicle)
        {
            if (!sender.AccountData.HavePerm("admin.cmds.vehicle.create"))
            {
                throw new Exception("Vous n'avez pas les permissions pour cela.");
            }

            var veh = Helper.CreateVehicle(
                target.ActiveCharacter, ModelHelper.ModelForModelType(vehicle),
                target.Position, target.Angle
                );

            return(veh.Id);
        }
        // GET: VehicleModelType/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VehicleModelType vehicleModelType = db.VehicleModelTypes.Find(id);

            if (vehicleModelType == null)
            {
                return(HttpNotFound());
            }
            return(View(vehicleModelType));
        }
Exemple #21
0
        public static VehicleModelType GetVehicleModelType(string model)
        {
            int minLevDistance            = 999;
            VehicleModelType nearestModel = new VehicleModelType();

            foreach (VehicleModelType m in (VehicleModelType[])Enum.GetValues(typeof(VehicleModelType)))
            {
                if (GetLevenshteinDistance(m.ToString(), model) < minLevDistance)
                {
                    minLevDistance = GetLevenshteinDistance(m.ToString(), model);
                    nearestModel   = m;
                }
            }
            Console.WriteLine("Utils.cs - Utils.GetVehicleModelType:I: Found model \"" + nearestModel + "\" for keyword \"" + model + "\", distance: " + minLevDistance);
            return(nearestModel);
        }
Exemple #22
0
        public static void VehicleSpawnTmp(Player sender, VehicleModelType vehicle)
        {
            if (!sender.AccountData.HavePerm("admin.cmds.vehicle.spawntmp"))
            {
                throw new Exception("Vous n'avez pas les permissions pour cela.");
            }

            var veh = Helper.CreateVehicle(
                sender.ActiveCharacter,
                ModelHelper.ModelForModelType(vehicle),
                sender.Position,
                sender.Angle,
                VehicleColor.BrighRed,
                VehicleColor.BrighRed,
                true
                );

            veh.Data.FuelConsumption = 0;
            sender.PutInVehicle(veh);
            veh.Engine = true;
        }
Exemple #23
0
        /// <summary>
        ///     Returns an instance of <see cref="VehicleModelInfo" /> containing information about the given
        ///     <see cref="VehicleModelType" />.
        /// </summary>
        /// <param name="model">The <see cref="VehicleModelType" /> to find information about.</param>
        /// <returns>An instance of <see cref="VehicleModelInfo" /> containing information about the given VehicleModelType.</returns>
        public static VehicleModelInfo ForVehicle(VehicleModelType model)
        {
            if ((int) model < 400 || (int) model > 611)
            {
                throw new ArgumentOutOfRangeException(nameof(model), "model is non-existant");
            }

            return VehicleModelInfos[(int) model - 400];
        }
Exemple #24
0
        public void SpawnVehicle(VehicleModelType model)
        {
            var v = BaseVehicle.Create(model, Position + new Vector3(0, 0.5f, 0), 0, -1, -1);

            PutInVehicle(v);
        }
Exemple #25
0
 public void SpawnVehicle(VehicleModelType model)
 {
     var v = BaseVehicle.Create(model, Position + new Vector3(0, 0.5f, 0), 0, -1, -1);
     PutInVehicle(v);
 }
        /// <summary>
        ///     Creates a static <see cref="BaseVehicle" /> in the world.
        /// </summary>
        /// <param name="vehicletype">The model for the vehicle.</param>
        /// <param name="position">The coordinates for the vehicle.</param>
        /// <param name="rotation">The facing angle for the vehicle.</param>
        /// <param name="color1">The primary color ID.</param>
        /// <param name="color2">The secondary color ID.</param>
        /// <returns> The <see cref="BaseVehicle" /> created.</returns>
        public virtual BaseVehicle CreateStatic(VehicleModelType vehicletype, Vector3 position, float rotation,
            int color1,
            int color2)
        {
            var id = Internal.AddStaticVehicle((int) vehicletype, position.X, position.Y, position.Z, rotation, color1,
                color2);

            return id == BaseVehicle.InvalidId ? null : BaseVehicle.FindOrCreate(id);
        }
Exemple #27
0
 public static VehicleModel ModelForModelType(VehicleModelType type)
 {
     return(Lists.VehicleModelList.Models.First(m => m.Model == type));
 }
Exemple #28
0
 public static void VehicleCommand(GtaPlayer player, VehicleModelType model)
 {
     player.SendClientMessage(Color.GreenYellow, "You have spawned a {0}", model);
     Console.WriteLine("Spawning a {0} {2} for {1}", model, player, (int) model);
     GtaVehicle vehicle = GtaVehicle.Create(model, player.Position + new Vector3(0, 0, 0.5f), player.Rotation.Z, -1,
         -1);
     player.PutInVehicle(vehicle);
 }
 public static void TestCommand(BasePlayer player, VehicleModelType value)
 {
     Console.WriteLine($"Test with VehicleModelType {value}");
     player.SendClientMessage($"You tested with VehicleModelType {value}");
 }
Exemple #30
0
 public static void TestCommand(BasePlayer player, VehicleModelType value)
 {
     Console.WriteLine($"Test with VehicleModelType {value}");
     player.SendClientMessage($"You tested with VehicleModelType {value}");
 }
Exemple #31
0
 public static void SpawnCommand(BasePlayer player, VehicleModelType type, float x, float y, float z, float a)
 {
     BaseVehicle.Create(type, new Vector3(x, y, z), a, -1, -1);
 }
Exemple #32
0
        public static void SpawnCommand(BasePlayer player, VehicleModelType type)
        {
            var vehicle = BaseVehicle.Create(type, player.Position + Vector3.Up, player.Angle, -1, -1);

            player.PutInVehicle(vehicle);
        }
Exemple #33
0
 private static void CreateVehCommand(BasePlayer player, VehicleModelType model)
 {
 }