コード例 #1
0
        public static async void Buy(int item, int price, int count = 1)
        {
            await User.GetAllData();

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

            int plId = User.GetServerId();

            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, 10, -1, -1, -1);

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

            if (item == 155)
            {
                User.Data.allow_marg = false;
                Sync.Data.Set(User.GetServerId(), "allow_marg", false);
                Notification.SendWithTime("~b~Рецепт на лечебную марихуану был изъят");
            }

            Managers.Inventory.UpdateAmount(User.Data.id, InventoryTypes.Player);
        }
コード例 #2
0
        public static async void Buy(int bId)
        {
            CurrentData = await GetAllData(bId);

            if (User.Data.age < 21 && Main.ServerName != "SunFlower")
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_26"));
                return;
            }

            if (!User.Data.biz_lic && Main.ServerName != "SunFlower")
            {
                Notification.SendWithTime("~r~У Вас нет лицензии на бизнес");
                return;
            }

            if (User.Data.money_bank < CurrentData.price)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_2"));
                return;
            }

            if (CurrentData.user_id != 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_30"));
                return;
            }

            if (User.Data.business_id != 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_31"));
                return;
            }

            Sync.Data.Set(User.GetServerId(), "business_id", CurrentData.id);

            await Delay(200);

            if (await Sync.Data.Get(User.GetServerId(), "business_id") == 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_32"));
                return;
            }


            User.RemoveBankMoney(CurrentData.price);
            Coffer.AddMoney(CurrentData.price + CurrentData.bank);
            Sync.Data.Set(-20000 + bId, "bank", 0);
            User.Data.business_id = CurrentData.id;
            Notification.SendWithTime(Lang.GetTextToPlayer("_lang_33"));

            Main.SaveLog("BuySellBizz", $"[BUY] {User.Data.id} {User.Data.rp_name} | {CurrentData.price} | {User.Data.business_id}");

            Sync.Data.Set(-20000 + bId, "user_id", User.Data.id);
            Sync.Data.Set(-20000 + bId, "user_name", User.Data.rp_name);
            User.SaveAccount();
            Save(CurrentData.id);
        }
コード例 #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);
            }
        }
コード例 #4
0
 public static void Equip()
 {
     if (User.Data.money < 2250)
     {
         Notification.SendWithTime("~r~ Недостаточно денег");
         return;
     }
     User.GiveWeapon((uint)WeaponHash.SMG, 140, false, false);
     User.GiveWeapon((uint)WeaponHash.PistolMk2, 60, false, false);
     Notification.SendWithTime("~g~Вы взяли оружие");
     Sync.Data.SetLocally(User.GetServerId(), "GrSix:Equip", true);
     User.RemoveMoney(2500);
     Coffer.AddMoney(2500);
 }
コード例 #5
0
        public static void BuyInterior(int bId, int id)
        {
            if (User.Data.money_bank < 50000)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_2"));
                return;
            }

            Sync.Data.Set(-20000 + bId, "interior", id);
            Notification.SendWithTime(Lang.GetTextToPlayer("_lang_29"));
            User.RemoveBankMoney(50000);
            Coffer.AddMoney(50000);
            Save(bId);
        }
コード例 #6
0
        public static void UniformSet()
        {
            if (User.Data.money < 1000)
            {
                Notification.SendWithTime("~r~У вас недостаточно денег");
                return;
            }
            int Armor  = 50;
            int r      = 150;
            var coords = GetEntityCoords(GetPlayerPed(-1), true);

            Shared.TriggerEventToAllPlayers("ARP:GiveArmorMp", coords.X, coords.Y, coords.Z, r, Armor);
            Notification.SendWithTime("~b~Готово");
            if (User.Skin.SEX == 1)
            {
                SetPedComponentVariation(GetPlayerPed(-1), 3, 117, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 4, 32, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 5, 44, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 6, 25, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 8, 154, 1, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 11, 46, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 7, 0, 0, 2);
            }
            else
            {
                SetPedComponentVariation(GetPlayerPed(-1), 3, 107, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 4, 31, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 5, 44, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 6, 25, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 8, 124, 1, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 11, 53, 0, 2);
                SetPedComponentVariation(GetPlayerPed(-1), 7, 0, 0, 2);
            }
            Sync.Data.SetLocally(User.GetServerId(), "GrSix:Uniform", true);
            User.RemoveMoney(1000);
            Coffer.AddMoney(1000);
        }
コード例 #7
0
        public static async void BuyHouse(CondoInfoGlobalData h)
        {
            await User.GetAllData();

            var hData = await GetAllData(h.id);

            var playerId = User.GetServerId();

            if (hData.id == 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_35"));
                return;
            }

            if (hData.id_user != 0)
            {
                Notification.SendWithTime("~r~Недвижимость уже куплена");
                return;
            }

            if (User.Data.condo_id != 0)
            {
                Notification.SendWithTime("~r~У Вас уже есть недвижимость");
                return;
            }

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

            Client.Sync.Data.Set(playerId, "condo_id", hData.id);

            await Delay(200);

            if (await Client.Sync.Data.Get(playerId, "condo_id") == 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_32"));
                return;
            }

            User.RemoveMoney(hData.price);
            Coffer.AddMoney(hData.price);

            User.Data.condo_id = hData.id;

            Main.SaveLog("BuySellCondo", $"[BUY] {User.Data.id} {User.Data.rp_name} | {hData.price} | {User.Data.condo_id}");


            Notification.SendWithTime("~g~Поздравляем с покупкой недвижимости");

            if (User.Data.reg_status != 3)
            {
                Client.Sync.Data.Set(playerId, "reg_time", 372);
                Client.Sync.Data.Set(playerId, "reg_status", 2);
            }

            TriggerServerEvent("ARP:UpdateCondoInfo", User.Data.rp_name, User.Data.id, hData.id);

            User.SaveAccount();
            MenuList.HideMenu();

            await Delay(10000);

            await User.GetAllData();
        }
コード例 #8
0
        public static async void BuyLic(int type)
        {
            if (User.Data.reg_status == 0)
            {
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_67"));
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_68"));
                return;
            }

            switch (type)
            {
            case 0:
                if (!User.Data.a_lic)
                {
                    if (User.GetMoneyWithoutSync() < 75)
                    {
                        Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                        return;
                    }

                    User.Data.a_lic = true;
                    Sync.Data.Set(User.GetServerId(), "a_lic", true);

                    User.RemoveMoney(75);
                    Coffer.AddMoney(75);

                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_69"));
                    break;
                }
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_70"));
                break;

            case 1:
                if (!User.Data.b_lic)
                {
                    if (User.GetMoneyWithoutSync() < 200)
                    {
                        Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                        return;
                    }

                    User.Data.b_lic = true;
                    Sync.Data.Set(User.GetServerId(), "b_lic", true);

                    User.RemoveMoney(200);
                    Coffer.AddMoney(200);

                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_69"));
                    break;
                }
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_70"));
                break;

            case 2:
                if (!User.Data.c_lic)
                {
                    if (User.GetMoneyWithoutSync() < 600)
                    {
                        Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                        return;
                    }

                    User.Data.c_lic = true;
                    Sync.Data.Set(User.GetServerId(), "c_lic", true);

                    User.RemoveMoney(600);
                    Coffer.AddMoney(600);

                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_69"));
                    break;
                }
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_70"));
                break;

            case 3:
                if (!User.Data.air_lic)
                {
                    if (User.GetMoneyWithoutSync() < 1200)
                    {
                        Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                        return;
                    }

                    User.Data.air_lic = true;
                    Sync.Data.Set(User.GetServerId(), "air_lic", true);

                    User.RemoveMoney(1200);
                    Coffer.AddMoney(1200);

                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_69"));
                    break;
                }
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_70"));
                break;

            case 4:
                if (!User.Data.ship_lic)
                {
                    if (User.GetMoneyWithoutSync() < 920)
                    {
                        Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                        return;
                    }

                    User.Data.ship_lic = true;
                    Sync.Data.Set(User.GetServerId(), "ship_lic", true);

                    User.RemoveMoney(920);
                    Coffer.AddMoney(920);

                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_69"));
                    break;
                }
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_70"));
                break;

            case 5:
                if (!User.Data.heli_lic)
                {
                    if (User.GetMoneyWithoutSync() < 1400)
                    {
                        Notification.SendWithTime(Lang.GetTextToPlayer("_lang_15"));
                        return;
                    }

                    User.Data.heli_lic = true;
                    Sync.Data.Set(User.GetServerId(), "heli_lic", true);

                    User.RemoveMoney(1400);
                    Coffer.AddMoney(1400);

                    Notification.SendWithTime(Lang.GetTextToPlayer("_lang_69"));
                    break;
                }
                Notification.SendWithTime(Lang.GetTextToPlayer("_lang_70"));
                break;
            }
        }