Exemplo n.º 1
0
        public static async void Wash(CitizenFX.Core.Vehicle veh)
        {
            DoScreenFadeOut(500);

            while (IsScreenFadingOut())
            {
                await Delay(1);
            }

            await Delay(500);

            veh.Wash();
            veh.DirtLevel = 0;
            User.RemoveCashMoney(21);
            Business.AddMoney(113, 21);

            await Delay(500);

            DoScreenFadeIn(500);

            while (IsScreenFadingIn())
            {
                await Delay(1);
            }

            Notification.SendWithTime(Lang.GetTextToPlayer("_lang_47"));
        }
Exemplo n.º 2
0
        public static async void Buy(string item, int price, int fuelId)
        {
            await User.GetAllData();

            if (User.GetMoneyWithoutSync() < price)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                return;
            }

            switch (item)
            {
            case "fuel_item":
                int amount = await Managers.Inventory.GetInvAmount(User.Data.id, InventoryTypes.Player);

                if (amount + Inventory.GetItemAmountById(9) > User.Amount)
                {
                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_60"));
                    return;
                }

                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_61"));
                Managers.Inventory.AddItemServer(9, 1, InventoryTypes.Player, User.Data.id, 1, -1, -1, -1);

                User.RemoveMoney(price);
                Business.AddMoney(fuelId, price);
                Managers.Inventory.UpdateAmount(User.Data.id, InventoryTypes.Player);
                break;
            }
        }
Exemplo n.º 3
0
        public static void NewCard(int bankId, int price)
        {
            if (User.Data.money < price)
            {
                Managers.Notification.SendWithTime(Lang.GetTextToPlayer("_lang_5"));
                return;
            }

            if (User.Data.bank_prefix > 0)
            {
                Managers.Notification.SendWithTime(Lang.GetTextToPlayer("_lang_8"));
                return;
            }

            Random rand   = new Random();
            int    prefix = 1111;

            switch (bankId)
            {
            case 1:
                prefix = 2222;
                break;

            case 2:
                prefix = 3333;
                break;

            case 108:
                prefix = 4444;
                break;
            }

            int plId = User.GetServerId();

            User.Data.bank_number = rand.Next(10000, 9999999);
            User.Data.bank_prefix = prefix;

            Sync.Data.Set(plId, "bank_prefix", prefix);
            Sync.Data.Set(plId, "bank_number", User.Data.bank_number);

            SendSmsBankOperationCreateCard();

            User.RemoveCashMoney(price);

            if (bankId == 0)
            {
                Coffer.AddMoney(price);
            }
            else
            {
                Business.AddMoney(bankId, price);
            }
        }
Exemplo n.º 4
0
        public static async void StartCombo(int casinoId, int rate)
        {
            Screen.LoadingPrompt.Show("Крутим барабан...");
            await Delay(10000);

            Screen.LoadingPrompt.Hide();

            var rand    = new Random();
            var number1 = rand.Next(9);
            var number2 = rand.Next(9);
            var number3 = rand.Next(9);

            if ((number1 == number2 || number2 == number3 || number1 == number3) && rand.Next(3) == 0)
            {
                number1 = rand.Next(9);
                number2 = rand.Next(9);
                number3 = rand.Next(9);
            }

            Notification.SendWithTime($"~g~Выпало число ~y~{number1}{number2}{number3}");

            if (number1 == number2 && number2 == number3)
            {
                rate = rate * 3;
                Notification.SendWithTime($"~g~Ваш выигрыш умножен на 3: ${rate:#,#}.");
                User.AddCashMoney(rate);
                Business.RemoveMoney(casinoId, rate);
            }
            else if (number1 == number2 || number2 == number3 || number1 == number3)
            {
                rate = rate * 2;
                Notification.SendWithTime($"~g~Ваш выигрыш умножен на 2: ${rate:#,#}.");
                User.AddCashMoney(rate);
                Business.RemoveMoney(casinoId, rate);
            }
            else
            {
                User.RemoveCashMoney(rate);
                Business.AddMoney(casinoId, rate);
                Notification.SendWithTime($"~r~Вы проиграли ${rate}");
            }
            await Delay(500);

            MenuList.ShowCasinoRateMenu(casinoId, 0);
        }
Exemplo n.º 5
0
        public static void RepairVeh(string number, int lscId)
        {
            CitizenFX.Core.Vehicle veh = Managers.Vehicle.GetVehicleByNumber(number);
            if (veh != null && veh.Handle > 0)
            {
                if (User.GetMoneyWithoutSync() < 200)
                {
                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_25"));
                    return;
                }

                User.RemoveMoney(200);
                Managers.Vehicle.Repair(veh);
                Business.AddMoney(lscId, 200);
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_40"));
            }
            else
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_41"));
            }
        }
Exemplo n.º 6
0
        public static async void FuelVeh(string number, int price, int fuelId, int index)
        {
            await User.GetAllData();

            if (User.GetMoneyWithoutSync() < price)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                return;
            }

            var vehId = Managers.Vehicle.GetVehicleIdByNumber(number);

            if (vehId == -1 || !Managers.Vehicle.HasVehicleId(vehId))
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_62"));
                return;
            }

            if (Convert.ToInt32(Managers.Vehicle.VehicleInfoGlobalDataList[vehId].Fuel) == Managers.Vehicle.VehicleInfoGlobalDataList[vehId].FullFuel)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_62"));
                return;
            }

            switch (index)
            {
            case 0:

                if (Managers.Vehicle.VehicleInfoGlobalDataList[vehId].FullFuel < Managers.Vehicle.VehicleInfoGlobalDataList[vehId].Fuel + 1)
                {
                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_62"));
                    break;
                }

                if (User.GetMoneyWithoutSync() < price)
                {
                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_25"));
                    break;
                }

                Managers.Vehicle.VehicleInfoGlobalDataList[vehId].Fuel += 1;
                Sync.Data.Set(vehId + 110000, "Fuel", Managers.Vehicle.VehicleInfoGlobalDataList[vehId].Fuel);
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_63", price));

                User.RemoveMoney(price);
                Business.AddMoney(fuelId, price);
                break;

            case 1:
                if (Managers.Vehicle.VehicleInfoGlobalDataList[vehId].FullFuel < Managers.Vehicle.VehicleInfoGlobalDataList[vehId].Fuel + 5)
                {
                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_62"));
                    break;
                }

                if (User.GetMoneyWithoutSync() < 5 * price)
                {
                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_25"));
                    break;
                }

                Managers.Vehicle.VehicleInfoGlobalDataList[vehId].Fuel += 5;
                Sync.Data.Set(vehId + 110000, "Fuel", Managers.Vehicle.VehicleInfoGlobalDataList[vehId].Fuel);
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_63", price * 5));

                User.RemoveMoney(5 * price);
                Business.AddMoney(fuelId, 5 * price);
                break;

            case 2:
                if (Managers.Vehicle.VehicleInfoGlobalDataList[vehId].FullFuel < Managers.Vehicle.VehicleInfoGlobalDataList[vehId].Fuel + 10)
                {
                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_62"));
                    break;
                }

                if (User.GetMoneyWithoutSync() < 10 * price)
                {
                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_25"));
                    break;
                }

                Managers.Vehicle.VehicleInfoGlobalDataList[vehId].Fuel += 10;
                Sync.Data.Set(vehId + 110000, "Fuel", Managers.Vehicle.VehicleInfoGlobalDataList[vehId].Fuel);
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_63", price * 10));

                User.RemoveMoney(10 * price);
                Business.AddMoney(fuelId, 10 * price);
                break;

            case 3:

                int money = Convert.ToInt32(Managers.Vehicle.VehicleInfoGlobalDataList[vehId].FullFuel - Managers.Vehicle.VehicleInfoGlobalDataList[vehId].Fuel);

                if (User.GetMoneyWithoutSync() < money * price)
                {
                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_25"));
                    break;
                }

                Managers.Vehicle.VehicleInfoGlobalDataList[vehId].Fuel = Managers.Vehicle.VehicleInfoGlobalDataList[vehId].FullFuel;
                Sync.Data.Set(vehId + 110000, "Fuel", Managers.Vehicle.VehicleInfoGlobalDataList[vehId].Fuel);
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_63", price * money));

                User.RemoveMoney(money * price);
                Business.AddMoney(fuelId, money * price);
                break;
            }
        }
Exemplo n.º 7
0
        private static async Task SecTimer()
        {
            await Delay(1000);

            var pos = GetEntityCoords(GetPlayerPed(-1), true);

            if (IsFindNpc)
            {
                if (IsPedInAnyVehicle(PlayerPedId(), true) && UI.GetCurrentSpeed() < 1)
                {
                    await Delay(5000);

                    foreach (var ped in Main.GetPedListOnRadius(pos, 20f))
                    {
                        if (User.IsAnimal(ped.Model.Hash))
                        {
                            continue;
                        }
                        if (IsPedInAnyVehicle(ped.Handle, true))
                        {
                            continue;
                        }
                        if (PedList.Contains(ped))
                        {
                            continue;
                        }

                        CurrentPed = ped;
                        PedList.Add(CurrentPed);
                        SetEntityAsMissionEntity(CurrentPed.Handle, true, true);
                        IsTask    = true;
                        IsFindNpc = false;
                        break;
                    }
                    if (IsTask)
                    {
                        var v = new CitizenFX.Core.Vehicle(GetVehiclePedIsUsing(PlayerPedId()))
                        {
                            LockStatus = VehicleLockStatus.Unlocked
                        };
                        TaskEnterVehicle(CurrentPed.Handle, v.Handle, 15000, 2, 1.0f, 1, 0);
                    }
                }
                else
                {
                    ResetAllTask();
                }
            }

            if (IsTask)
            {
                if (IsPedInAnyVehicle(PlayerPedId(), true))
                {
                    if (!IsTaskRoad)
                    {
                        if (IsPedInAnyVehicle(PlayerPedId(), false) && IsPedInAnyVehicle(CurrentPed.Handle, false))
                        {
                            IsTaskRoad = true;
                            new CitizenFX.Core.Vehicle(GetVehiclePedIsUsing(PlayerPedId()))
                            {
                                LockStatus = VehicleLockStatus.StickPlayerInside
                            };
                            var house    = House.GetRandomHouseInLosSantos();
                            var housePos = new Vector3(house.x, house.y, house.z);
                            //User.SetWaypoint(house.x, house.y);
                            Managers.Blip.Create(housePos);
                            Managers.Blip.ShowRoute(true);

                            RoadDistance = CalculateTravelDistanceBetweenPoints(pos.X, pos.Y, pos.Z, house.x, house.y, house.z);
                            if (RoadDistance < 150)
                            {
                                RoadDistance = Main.GetDistanceToSquared(housePos, pos);
                            }

                            CheckpointId = Managers.Checkpoint.Create(new Vector3(house.x, house.y, house.z), 50f,
                                                                      "taxi:finish");
                            Notification.SendWithTime("~g~Маршрут построен");
                        }
                    }
                    else
                    {
                        if (UI.GetCurrentSpeed() > 55)
                        {
                            Warning++;
                            Notification.SendWithTime("~y~Не превышайте скорость");
                            Notification.SendWithTime("~y~Итоговая стоимость поездки будет ниже");
                            await Delay(5000);
                        }
                    }

                    if (IsTaskRoadFinish && UI.GetCurrentSpeed() < 1)
                    {
                        IsTask = false;
                        var v = new CitizenFX.Core.Vehicle(GetVehiclePedIsUsing(PlayerPedId()))
                        {
                            LockStatus = VehicleLockStatus.Unlocked
                        };
                        TaskLeaveVehicle(CurrentPed.Handle, GetVehiclePedIsUsing(CurrentPed.Handle), 1);
                        int money = Convert.ToInt32(RoadDistance / 20) * User.Bonus;
                        if (money > 1000)
                        {
                            money = 1000;
                        }

                        int star = 5;
                        if (Warning > 0)
                        {
                            if (Warning > 9)
                            {
                                Warning = 9;
                            }
                            star = Convert.ToInt32(Math.Round((10 - Warning) / 2f, 1));
                            int moneyWarning = Warning * 5;
                            if (moneyWarning >= money)
                            {
                                money = 20;
                            }
                            else
                            {
                                money = money - moneyWarning;
                            }
                            Notification.SendWithTime($"~y~Сумма штрафа: ~s~${moneyWarning:#,#}");
                        }
                        else
                        {
                            money = money + 20;
                            Notification.SendWithTime("~b~Бонус за поездку: ~s~$20");
                        }

                        int moneyTaxi = Convert.ToInt32(money * 0.1);
                        int moneyUser = Convert.ToInt32(money * 0.9);
                        Notification.SendWithTime($"~g~Вы заработали: ~s~${moneyUser:#,#}");
                        Notification.SendWithTime($"~g~Отдали таксопарку: ~s~${moneyTaxi:#,#}");
                        Notification.SendWithTime($"~g~Оценка за поездку: ~s~{star} зв.");
                        User.AddCashMoney(moneyUser);

                        if (v.Model.Hash == 2088999036)
                        {
                            Business.AddMoney(92, moneyTaxi);
                        }
                        else
                        {
                            Business.AddMoney(114, moneyTaxi);
                        }

                        await Delay(3500);

                        foreach (var vehicleDoor in v.Doors)
                        {
                            if (vehicleDoor.IsOpen)
                            {
                                vehicleDoor.Close();
                            }
                        }
                        ResetAllTask();
                    }
                }
                else
                {
                    ResetAllTask();
                }
            }
        }
Exemplo n.º 8
0
        public static async void Buy(string item, int price, int shopId)
        {
            await User.GetAllData();

            if (User.GetMoneyWithoutSync() < price)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                return;
            }

            switch (item)
            {
            case "water":
                Chat.SendMeCommand(Lang.GetTextToPlayer("_lang_16"));
                User.AddWaterLevel(100);
                User.RemoveMoney(price);
                Business.AddMoney(shopId, price);

                User.PlayDrinkAnimation();
                break;

            case "cola":
                Chat.SendMeCommand(Lang.GetTextToPlayer("_lang_17"));
                User.AddWaterLevel(20);
                User.RemoveMoney(price);
                Business.AddMoney(shopId, price);

                User.PlayDrinkAnimation();
                break;

            case "limonad":
                Chat.SendMeCommand(Lang.GetTextToPlayer("_lang_18"));
                User.AddWaterLevel(20);
                User.RemoveMoney(price);
                Business.AddMoney(shopId, price);

                User.PlayDrinkAnimation();
                break;

            case "bear":
                Chat.SendMeCommand(Lang.GetTextToPlayer("_lang_19"));
                User.RemoveMoney(price);
                Business.AddMoney(shopId, price);

                User.AddDrunkLevel(2);

                User.PlayDrinkAnimation();
                break;

            case "vodka":
                Chat.SendMeCommand(Lang.GetTextToPlayer("_lang_20"));
                User.RemoveMoney(price);
                Business.AddMoney(shopId, price);

                User.AddDrunkLevel(4);

                User.PlayDrinkAnimation();
                break;

            case "whishkey":
                Chat.SendMeCommand(Lang.GetTextToPlayer("_lang_21"));
                User.RemoveMoney(price);
                Business.AddMoney(shopId, price);

                User.AddDrunkLevel(5);

                User.PlayDrinkAnimation();
                break;
            }
        }
Exemplo n.º 9
0
        public static async void Buy(int item, int price, int shopId, int count = 1)
        {
            await User.GetAllData();

            if (User.GetMoneyWithoutSync() < price * count)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                return;
            }

            int plId = User.GetServerId();

            switch (item)
            {
            case 8:
                if (User.Data.phone_code > 0 || User.Data.phone > 0)
                {
                    Managers.Inventory.UnEquipItem(8);
                    await Delay(2000);
                }

                Random rand = new Random();

                User.Data.phone_code = 555;
                User.Data.phone      = rand.Next(10000, 999999);

                Sync.Data.Set(plId, "phone_code", User.Data.phone_code);
                Sync.Data.Set(plId, "phone", User.Data.phone);
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_80", $"{User.Data.phone_code}-{User.Data.phone}"));

                User.RemoveMoney(price);
                Business.AddMoney(shopId, price);
                break;

            case 7:
                if (User.Data.item_clock)
                {
                    Managers.Inventory.UnEquipItem(7);
                    await Delay(1000);
                }

                User.Data.item_clock = true;
                Sync.Data.Set(plId, "item_clock", User.Data.item_clock);
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_81"));

                User.RemoveMoney(price);
                Business.AddMoney(shopId, price);
                break;

            case 47:

                if (User.Data.is_buy_walkietalkie)
                {
                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_82"));
                    break;
                }

                User.Data.is_buy_walkietalkie = true;
                User.Data.walkietalkie_num    = "70";
                Sync.Data.Set(plId, "is_buy_walkietalkie", true);
                Sync.Data.Set(plId, "walkietalkie_num", "70");
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_83"));

                User.RemoveMoney(price);
                Business.AddMoney(shopId, price);
                break;

            default:
                int amount = await Managers.Inventory.GetInvAmount(User.Data.id, InventoryTypes.Player);

                if (amount + Inventory.GetItemAmountById(item) > User.Amount)
                {
                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_60"));
                    return;
                }
                Managers.Inventory.AddItemServer(item, count, InventoryTypes.Player, User.Data.id, 1, -1, -1, -1);

                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_84", Inventory.GetItemNameById(item), count));
                User.RemoveMoney(price * count);
                Business.AddMoney(shopId, price * count);

                Managers.Inventory.UpdateAmount(User.Data.id, InventoryTypes.Player);
                break;
            }
        }
Exemplo n.º 10
0
        public static async void StartRulet(int casinoId, int rate, int idx)
        {
            switch (idx)
            {
            case 0:
                Notification.SendWithTime("~b~Вы сделали ставку на ~y~Red");
                break;

            case 1:
                Notification.SendWithTime("~b~Вы сделали ставку на ~y~Black");
                break;

            default:
                Notification.SendWithTime("~b~Вы сделали ставку на ~y~Zero");
                break;
            }

            Screen.LoadingPrompt.Show("Крутим рулетку...");
            await Delay(10000);

            Screen.LoadingPrompt.Hide();

            var rand   = new Random();
            var number = rand.Next(36);

            await Delay(500);

            MenuList.ShowCasinoRateMenu(casinoId, 1);

            if (number % 2 == 0)
            {
                if (idx == 1 && rand.Next(4) > 1)
                {
                    number++;
                }
            }
            else
            {
                if (idx == 0 && rand.Next(4) > 1)
                {
                    number++;
                }
            }

            if (number == 0)
            {
                Notification.SendWithTime("~g~Выпало ~y~Zero");

                if (idx == 2)
                {
                    rate = rate * 5;
                    Notification.SendWithTime($"~g~Ваш выигрыш умножен на 5: ${rate:#,#}.");
                    User.AddCashMoney(rate);
                    Business.RemoveMoney(casinoId, rate);
                    return;
                }

                User.RemoveCashMoney(rate);
                Business.AddMoney(casinoId, rate);

                Notification.SendWithTime($"~r~Вы проиграли ${rate}");
            }
            else if (number % 2 == 0)
            {
                Notification.SendWithTime("~g~Выпал ~y~Black");
                if (idx == 1)
                {
                    rate = Convert.ToInt32(rate * 1.5);
                    Notification.SendWithTime($"~g~Ваш выигрыш умножен на 1.5: ${rate:#,#}.");
                    User.AddCashMoney(rate);
                    Business.RemoveMoney(casinoId, rate);
                    return;
                }

                User.RemoveCashMoney(rate);
                Business.AddMoney(casinoId, rate);

                Notification.SendWithTime($"~r~Вы проиграли ${rate}");
            }
            else
            {
                Notification.SendWithTime("~g~Выпал ~y~Red");
                if (idx == 0)
                {
                    rate = Convert.ToInt32(rate * 1.5);
                    Notification.SendWithTime($"~g~Ваш выигрыш умножен на 1.5: ${rate:#,#}.");
                    User.AddCashMoney(rate);
                    Business.RemoveMoney(casinoId, rate);
                    return;
                }

                User.RemoveCashMoney(rate);
                Business.AddMoney(casinoId, rate);

                Notification.SendWithTime($"~r~Вы проиграли ${rate}");
            }
        }
Exemplo n.º 11
0
        public static async void Buy(int item, int price, int count, int shopId)
        {
            await User.GetAllData();

            if (User.GetMoneyWithoutSync() < price)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                return;
            }

            int amount = await Managers.Inventory.GetInvAmount(User.Data.id, InventoryTypes.Player);

            if (Client.Inventory.GetItemAmountById(item) + amount > User.Amount)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_60"));
                return;
            }

            switch (item)
            {
            case int n when(n <= 136 && n >= 54):

                foreach (uint hash in Enum.GetValues(typeof(WeaponHash)))
                {
                    string name = Enum.GetName(typeof(WeaponHash), hash);

                    if (!String.Equals(name, Client.Inventory.GetItemNameHashById(n), StringComparison.CurrentCultureIgnoreCase))
                    {
                        continue;
                    }

                    Managers.Inventory.AddItemServer(n, 1, InventoryTypes.Player, User.Data.id, 1, -1, -1, -1);

                    User.RemoveMoney(price);
                    Business.AddMoney(shopId, price);
                    break;
                }

                break;

            case 27:
            case 28:
            case 29:
            case 30:
            case 146:
            case 147:
            case 148:
            case 149:
            case 150:
            case 151:
            case 152:
            case 153:
            case 276:

                int ptFull = count;
                while (ptFull > 0)
                {
                    if (ptFull <= Managers.Inventory.AmmoItemIdToMaxCount(item))
                    {
                        Managers.Inventory.AddItemServer(item, 1, InventoryTypes.Player, User.Data.id, ptFull, -1, -1, -1);
                        ptFull = 0;
                    }
                    else
                    {
                        Managers.Inventory.AddItemServer(item, 1, InventoryTypes.Player, User.Data.id, Managers.Inventory.AmmoItemIdToMaxCount(item), -1, -1, -1);
                        ptFull = ptFull - Managers.Inventory.AmmoItemIdToMaxCount(item);
                    }
                }

                User.RemoveMoney(price);
                Business.AddMoney(shopId, price);
                break;
            }

            Managers.Inventory.UpdateAmount(User.Data.id, InventoryTypes.Player);
        }
Exemplo n.º 12
0
        public static async void BuyTaxi(VehicleHash hash, int price = 150, int shopId = -1)
        {
            if (User.GetMoneyWithoutSync() < price)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                return;
            }

            if (!User.Data.b_lic)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_78"));
                return;
            }

            if (!User.Data.taxi_lic)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_79"));
                return;
            }

            User.RemoveMoney(price);
            Business.AddMoney(shopId, price);

            Random rand   = new Random();
            var    number = "TAXI" + rand.Next(900) + 99;

            var vehicleHash = Convert.ToUInt32(hash);

            if (!await Main.LoadModel(vehicleHash))
            {
                return;
            }

            if (shopId == 92)
            {
                var veh = CreateVehicle(Convert.ToUInt32(hash), -1052.034f, -249.933f, 37.40583f, 218.1207f, true, false);

                CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh)
                {
                    IsEngineRunning = true
                };

                SetVehicleNumberPlateText(vehicle.Handle, number);

                new CitizenFX.Core.Ped(PlayerPedId()).SetIntoVehicle(vehicle, VehicleSeat.Driver);
                SetVehicleOnGroundProperly(vehicle.Handle);
            }
            else
            {
                var veh = CreateVehicle(Convert.ToUInt32(hash), 906.6081f, -186.1309f, 74.62754f, 56.05503f, true, false);

                CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh)
                {
                    IsEngineRunning = true
                };

                SetVehicleNumberPlateText(vehicle.Handle, number);

                new CitizenFX.Core.Ped(PlayerPedId()).SetIntoVehicle(vehicle, VehicleSeat.Driver);
                SetVehicleOnGroundProperly(vehicle.Handle);
            }


            if (!User.HasVehicleKey(number))
            {
                User.AddVehicleKey(number);
            }
        }
Exemplo n.º 13
0
        public static async void BuyCar(VehicleHash hash, int price, int shopId)
        {
            if (User.GetMoneyWithoutSync() < price)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                return;
            }

            if (!User.Data.b_lic)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_78"));
                return;
            }

            if (shopId == 88 && !User.Data.ship_lic)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("133"));
                return;
            }

            if ((shopId == 89 || shopId == 90) && !User.Data.heli_lic)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("134"));
                return;
            }

            if (shopId == 93 && !User.Data.air_lic)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("135"));
                return;
            }



            User.RemoveMoney(price);
            Business.AddMoney(shopId, price);

            Random rand   = new Random();
            var    color  = rand.Next(156);
            var    number = "RENT" + rand.Next(9) + color;

            //var coords = GetEntityCoords(GetPlayerPed(-1), true);

            var coords = new Vector3((float)Main.RentCarMarkers[0, 4], (float)Main.RentCarMarkers[0, 5],
                                     (float)Main.RentCarMarkers[0, 6]);

            /*if (shopId == 87)
             *  coords = new Vector3((float) Main.RentCarMarkers[1, 4], (float) Main.RentCarMarkers[1, 5],
             *      (float) Main.RentCarMarkers[1, 6]);*/
            if (shopId == 88)
            {
                coords = new Vector3((float)Main.RentCarMarkers[1, 4], (float)Main.RentCarMarkers[1, 5],
                                     (float)Main.RentCarMarkers[1, 6]);
            }
            else if (shopId == 89)
            {
                coords = new Vector3((float)Main.RentCarMarkers[2, 4], (float)Main.RentCarMarkers[2, 5],
                                     (float)Main.RentCarMarkers[2, 6]);
            }
            else if (shopId == 90)
            {
                coords = new Vector3((float)Main.RentCarMarkers[3, 4], (float)Main.RentCarMarkers[3, 5],
                                     (float)Main.RentCarMarkers[3, 6]);
            }
            else if (shopId == 93)
            {
                coords = new Vector3((float)Main.RentCarMarkers[4, 4], (float)Main.RentCarMarkers[4, 5],
                                     (float)Main.RentCarMarkers[4, 6]);
            }

            var vehicleHash = Convert.ToUInt32(hash);

            if (!await Main.LoadModel(vehicleHash))
            {
                return;
            }

            var veh = CreateVehicle(Convert.ToUInt32(hash), coords.X, coords.Y, coords.Z + 1f, (shopId == 87 ? 173.1862f : 67.43578f), true, false);

            CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh)
            {
                IsEngineRunning = true
            };

            SetVehicleColours(vehicle.Handle, color, color);
            SetVehicleNumberPlateText(vehicle.Handle, number);

            new CitizenFX.Core.Ped(PlayerPedId()).SetIntoVehicle(vehicle, VehicleSeat.Driver);
            SetVehicleOnGroundProperly(vehicle.Handle);

            if (!User.HasVehicleKey(number))
            {
                User.AddVehicleKey(number);
            }
        }
Exemplo n.º 14
0
        public static async void Buy(int item, int price, int shopId)
        {
            if (User.GetMoneyWithoutSync() < price)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                return;
            }

            if (!User.Data.a_lic && item > 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_77"));
                return;
            }

            User.RemoveMoney(price);
            Business.AddMoney(shopId, price);

            Random rand   = new Random();
            var    color  = rand.Next(156);
            var    number = "RENT" + rand.Next(9) + color;
            var    coords = GetEntityCoords(GetPlayerPed(-1), true);

            switch (item)
            {
            case 1:
            {
                var vehicleHash = Convert.ToUInt32(VehicleHash.Cruiser);

                if (!await Main.LoadModel(vehicleHash))
                {
                    return;
                }

                var veh = CreateVehicle(Convert.ToUInt32(VehicleHash.Cruiser), coords.X, coords.Y, coords.Z + 1f, GetEntityHeading(GetPlayerPed(-1)), true, false);

                CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh)
                {
                    IsEngineRunning = true
                };

                SetVehicleColours(vehicle.Handle, color, color);
                SetVehicleNumberPlateText(vehicle.Handle, number);

                new CitizenFX.Core.Ped(PlayerPedId()).SetIntoVehicle(vehicle, VehicleSeat.Driver);
                SetVehicleOnGroundProperly(vehicle.Handle);

                if (!User.HasVehicleKey(number))
                {
                    User.AddVehicleKey(number);
                }
                break;
            }

            case 2:
            {
                var vehicleHash = Convert.ToUInt32(VehicleHash.Bmx);
                if (!await Main.LoadModel(vehicleHash))
                {
                    return;
                }
                var veh = CreateVehicle(Convert.ToUInt32(VehicleHash.Bmx), coords.X, coords.Y, coords.Z + 1f, GetEntityHeading(GetPlayerPed(-1)), true, false);

                CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh)
                {
                    IsEngineRunning = true
                };

                SetVehicleColours(vehicle.Handle, color, color);
                SetVehicleNumberPlateText(vehicle.Handle, number);

                new CitizenFX.Core.Ped(PlayerPedId()).SetIntoVehicle(vehicle, VehicleSeat.Driver);
                SetVehicleOnGroundProperly(vehicle.Handle);

                if (!User.HasVehicleKey(number))
                {
                    User.AddVehicleKey(number);
                }
                break;
            }

            case 3:
            {
                var vehicleHash = Convert.ToUInt32(VehicleHash.Scorcher);
                if (!await Main.LoadModel(vehicleHash))
                {
                    return;
                }
                var veh = CreateVehicle(Convert.ToUInt32(VehicleHash.Scorcher), coords.X, coords.Y, coords.Z + 1f, GetEntityHeading(GetPlayerPed(-1)), true, false);

                CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh)
                {
                    IsEngineRunning = true
                };

                SetVehicleColours(vehicle.Handle, color, color);
                SetVehicleNumberPlateText(vehicle.Handle, number);

                new CitizenFX.Core.Ped(PlayerPedId()).SetIntoVehicle(vehicle, VehicleSeat.Driver);
                SetVehicleOnGroundProperly(vehicle.Handle);

                if (!User.HasVehicleKey(number))
                {
                    User.AddVehicleKey(number);
                }
                break;
            }

            case 4:
            {
                var vehicleHash = Convert.ToUInt32(VehicleHash.Fixter);
                if (!await Main.LoadModel(vehicleHash))
                {
                    return;
                }
                var veh = CreateVehicle(Convert.ToUInt32(VehicleHash.Fixter), coords.X, coords.Y, coords.Z + 1f, GetEntityHeading(GetPlayerPed(-1)), true, false);

                CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh)
                {
                    IsEngineRunning = true
                };

                SetVehicleColours(vehicle.Handle, color, color);
                SetVehicleNumberPlateText(vehicle.Handle, number);

                new CitizenFX.Core.Ped(PlayerPedId()).SetIntoVehicle(vehicle, VehicleSeat.Driver);
                SetVehicleOnGroundProperly(vehicle.Handle);

                if (!User.HasVehicleKey(number))
                {
                    User.AddVehicleKey(number);
                }
                break;
            }

            case 5:
            {
                var vehicleHash = Convert.ToUInt32(VehicleHash.TriBike);
                if (!await Main.LoadModel(vehicleHash))
                {
                    return;
                }
                var veh = CreateVehicle(Convert.ToUInt32(VehicleHash.TriBike), coords.X, coords.Y, coords.Z + 1f, GetEntityHeading(GetPlayerPed(-1)), true, false);

                CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh)
                {
                    IsEngineRunning = true
                };

                SetVehicleColours(vehicle.Handle, color, color);
                SetVehicleNumberPlateText(vehicle.Handle, number);

                new CitizenFX.Core.Ped(PlayerPedId()).SetIntoVehicle(vehicle, VehicleSeat.Driver);
                SetVehicleOnGroundProperly(vehicle.Handle);

                if (!User.HasVehicleKey(number))
                {
                    User.AddVehicleKey(number);
                }
                break;
            }

            case 6:
            {
                var vehicleHash = Convert.ToUInt32(VehicleHash.TriBike2);
                if (!await Main.LoadModel(vehicleHash))
                {
                    return;
                }
                var veh = CreateVehicle(Convert.ToUInt32(VehicleHash.TriBike2), coords.X, coords.Y, coords.Z + 1f, GetEntityHeading(GetPlayerPed(-1)), true, false);

                CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh)
                {
                    IsEngineRunning = true
                };

                SetVehicleColours(vehicle.Handle, color, color);
                SetVehicleNumberPlateText(vehicle.Handle, number);

                new CitizenFX.Core.Ped(PlayerPedId()).SetIntoVehicle(vehicle, VehicleSeat.Driver);
                SetVehicleOnGroundProperly(vehicle.Handle);

                if (!User.HasVehicleKey(number))
                {
                    User.AddVehicleKey(number);
                }
                break;
            }

            case 7:
            {
                var vehicleHash = Convert.ToUInt32(VehicleHash.TriBike3);
                if (!await Main.LoadModel(vehicleHash))
                {
                    return;
                }
                var veh = CreateVehicle(Convert.ToUInt32(VehicleHash.TriBike3), coords.X, coords.Y, coords.Z + 1f, GetEntityHeading(GetPlayerPed(-1)), true, false);

                CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh)
                {
                    IsEngineRunning = true
                };

                SetVehicleColours(vehicle.Handle, color, color);
                SetVehicleNumberPlateText(vehicle.Handle, number);

                new CitizenFX.Core.Ped(PlayerPedId()).SetIntoVehicle(vehicle, VehicleSeat.Driver);
                SetVehicleOnGroundProperly(vehicle.Handle);

                if (!User.HasVehicleKey(number))
                {
                    User.AddVehicleKey(number);
                }
                break;
            }

            case 8:
            {
                var vehicleHash = Convert.ToUInt32(VehicleHash.Faggio2);
                if (!await Main.LoadModel(vehicleHash))
                {
                    return;
                }
                var veh = CreateVehicle(Convert.ToUInt32(VehicleHash.Faggio2), coords.X, coords.Y, coords.Z + 1f,
                                        GetEntityHeading(GetPlayerPed(-1)), true, false);

                CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh)
                {
                    IsEngineRunning = true
                };

                SetVehicleColours(vehicle.Handle, color, color);
                SetVehicleNumberPlateText(vehicle.Handle, number);

                new CitizenFX.Core.Ped(PlayerPedId()).SetIntoVehicle(vehicle, VehicleSeat.Driver);
                SetVehicleOnGroundProperly(vehicle.Handle);

                if (!User.HasVehicleKey(number))
                {
                    User.AddVehicleKey(number);
                }
                break;
            }

            case 9:
            {
                var vehicleHash = Convert.ToUInt32(VehicleHash.Faggio);
                if (!await Main.LoadModel(vehicleHash))
                {
                    return;
                }
                var veh = CreateVehicle(Convert.ToUInt32(VehicleHash.Faggio), coords.X, coords.Y, coords.Z + 1f, GetEntityHeading(GetPlayerPed(-1)), true, false);

                CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh)
                {
                    IsEngineRunning = true
                };

                SetVehicleColours(vehicle.Handle, color, color);
                SetVehicleNumberPlateText(vehicle.Handle, number);

                new CitizenFX.Core.Ped(PlayerPedId()).SetIntoVehicle(vehicle, VehicleSeat.Driver);
                SetVehicleOnGroundProperly(vehicle.Handle);

                if (!User.HasVehicleKey(number))
                {
                    User.AddVehicleKey(number);
                }
                break;
            }

            default:
            {
                var vehicleHash = Convert.ToUInt32(VehicleHash.Scorcher);
                if (!await Main.LoadModel(vehicleHash))
                {
                    return;
                }
                var veh = CreateVehicle(Convert.ToUInt32(VehicleHash.Scorcher), coords.X, coords.Y, coords.Z + 1f, GetEntityHeading(GetPlayerPed(-1)), true, false);

                CitizenFX.Core.Vehicle vehicle = new CitizenFX.Core.Vehicle(veh)
                {
                    IsEngineRunning = true
                };

                SetVehicleColours(vehicle.Handle, color, color);
                SetVehicleNumberPlateText(vehicle.Handle, number);

                new CitizenFX.Core.Ped(PlayerPedId()).SetIntoVehicle(vehicle, VehicleSeat.Driver);
                SetVehicleOnGroundProperly(vehicle.Handle);

                if (!User.HasVehicleKey(number))
                {
                    User.AddVehicleKey(number);
                }
                break;
            }
            }
        }