Beispiel #1
0
        public bool CreateCar(Vector3 _position, GrandTheftMultiplayer.Shared.VehicleHash _vehicle)
        {
            try
            {
                var id   = _repository.Current.Count > 0 ? _repository.Current.LastOrDefault().VehicleId + 1 : 1;
                var _veh = new Models.Vehicle
                {
                    VehicleId           = id,
                    Plate               = "LS" + id,
                    Color1              = 131,
                    Color2              = 131,
                    Fuel                = 100,
                    IsLocked            = false,
                    LastPosition        = _position,
                    LastRotation        = _position,
                    OwnerSocialClubName = "",
                    VehicleModelId      = _vehicle,
                    FactionId           = -1,
                    JobId               = -1
                };

                for (int i = 0; i <= 69; i++)
                {
                    _veh.Mods[i] = -1;
                }

                _repository.Add(_veh);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Beispiel #2
0
        public bool CreateCar(Vector3 _position, GrandTheftMultiplayer.Shared.VehicleHash _vehicle)
        {
            try
            {
                var _veh = new Models.Vehicle
                {
                    VehicleId           = currentVehList.Items.Count > 0 ? currentVehList.Items.LastOrDefault().VehicleId + 1 : 1,
                    Plate               = "LS" + (currentVehList.Items.Count > 0 ? currentVehList.Items.LastOrDefault().VehicleId + 1 : 1).ToString(),
                    Color1              = 131,
                    Color2              = 131,
                    Fuel                = 100,
                    IsLocked            = false,
                    LastPosition        = _position,
                    LastRotation        = _position,
                    OwnerSocialClubName = "",
                    VehicleModelId      = _vehicle,
                    FactionId           = -1,
                    JobId               = -1
                };

                for (int i = 0; i <= 69; i++)
                {
                    _veh.Mods[i] = -1;
                }

                currentVehList.Items.Add(_veh);
                SaveChanges();


                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Beispiel #3
0
        public static bool OwnACar(Client _Owner, GrandTheftMultiplayer.Server.Elements.Vehicle _vehicle, GrandTheftMultiplayer.Shared.VehicleHash _VehModelId)
        {
            try
            {
                var _veh = new Models.Vehicle
                {
                    VehicleId = currentVehList.Items.Count > 0 ? currentVehList.Items.LastOrDefault().VehicleId + 1 : 1,
                    Plate     = "LS" + (currentVehList.Items.Count > 0 ? currentVehList.Items.LastOrDefault().VehicleId + 1 : 1).ToString(),
                    //Color1 = _vehicle.primaryColor,
                    //Color2 = _vehicle.secondaryColor,
                    Fuel                = 100,
                    IsLocked            = false,
                    LastPosition        = _vehicle.position,
                    LastRotation        = _vehicle.rotation,
                    OwnerSocialClubName = _Owner.socialClubName,
                    VehicleModelId      = _VehModelId,
                    FactionId           = -1,
                    JobId               = -1,
                };

                for (int i = 0; i <= 69; i++)
                {
                    _veh.Mods[i] = -1;
                }

                currentVehList.Items.Add(_veh);
                SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                API.shared.consoleOutput(LogCat.Warn, ex.ToString());
                return(false);
            }
        }