Exemplo n.º 1
0
        public static void Event_InteractPressed(Client player, int id)
        {
            switch (id)
            {
            case 54:
                NAPI.Entity.SetEntityPosition(player, ExitAlcoShop[player.GetData("CLUB")] + new Vector3(0, 0, 1.2));
                return;

            case 55:
                NAPI.Entity.SetEntityPosition(player, EnterAlcoShop[player.GetData("CLUB")] + new Vector3(0, 0, 1.2));
                return;

            case 56:
                if (!Main.Players.ContainsKey(player))
                {
                    return;
                }

                if (Main.Players[player].FractionID != player.GetData("CLUB"))
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не состоите в {Fractions.Manager.getName(player.GetData("CLUB"))}", 3000);
                    return;
                }

                if (!player.IsInVehicle)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Вы должны находиться в машине", 3000);
                    return;
                }

                int club = player.GetData("CLUB");

                var matCount = VehicleInventory.GetCountOfType(player.Vehicle, ItemType.Material);
                if (matCount == 0)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "В машине нет материала", 3000);
                    return;
                }

                if (ClubsStocks[club].Materials >= MaxMats)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Склад заполнен", 3000);
                    return;
                }

                VehicleInventory.Remove(player.Vehicle, ItemType.Material, matCount);
                ClubsStocks[club].Materials += matCount;
                ClubsStocks[club].UpdateLabel();
                Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, "Вы выгрузили весь материал из машины на склад клуба", 3000);
                return;

            case 57:
                if (!Main.Players.ContainsKey(player))
                {
                    return;
                }
                OpenBuyAlcoholMenu(player);
                return;
            }
        }
Exemplo n.º 2
0
        public static void interactPressed(Client player, int interact)
        {
            switch (interact)
            {
            case 15:
                if (player.IsInVehicle)
                {
                    return;
                }
                if (player.HasData("FOLLOWING"))
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000);
                    return;
                }
                player.SetData("IN_HOSPITAL", true);
                NAPI.Entity.SetEntityPosition(player, emsCheckpoints[1] + new Vector3(0, 0, 1.12));
                Main.PlayerEnterInterior(player, emsCheckpoints[1] + new Vector3(0, 0, 1.12));
                return;

            case 16:
                if (player.HasData("FOLLOWING"))
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000);
                    return;
                }
                if (NAPI.Player.GetPlayerHealth(player) < 100)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны сначала закончить лечение", 3000);
                    break;
                }

                /*if (player.HasData("HEAL_TIMER"))
                 * {
                 *  Main.StopT(player.GetData("HEAL_TIMER"));
                 *  player.ResetData("HEAL_TIMER");
                 *  Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Ваше лечение закончено", 3000);
                 * }*/
                player.SetData("IN_HOSPITAL", false);
                NAPI.Entity.SetEntityPosition(player, emsCheckpoints[0] + new Vector3(0, 0, 1.12));
                Main.PlayerEnterInterior(player, emsCheckpoints[0] + new Vector3(0, 0, 1.12));
                return;

            case 17:
                if (Main.Players[player].FractionID != 8)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник EMS", 3000);
                    return;
                }
                if (!player.GetData("ON_DUTY"))
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не начали рабочий день", 3000);
                    return;
                }
                if (!Stocks.fracStocks[8].IsOpen)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Склад закрыт", 3000);
                    return;
                }
                OpenHospitalStockMenu(player);
                return;

            case 18:
                if (Main.Players[player].FractionID == 8)
                {
                    if (!NAPI.Data.GetEntityData(player, "ON_DUTY"))
                    {
                        Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы начали рабочий день", 3000);
                        Manager.setSkin(player, 8, Main.Players[player].FractionLVL);
                        NAPI.Data.SetEntityData(player, "ON_DUTY", true);
                        break;
                    }
                    else
                    {
                        Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы закончили рабочий день", 3000);
                        Customization.ApplyCharacter(player);
                        if (player.HasData("HAND_MONEY"))
                        {
                            player.SetClothes(5, 45, 0);
                        }
                        else if (player.HasData("HEIST_DRILL"))
                        {
                            player.SetClothes(5, 41, 0);
                        }
                        NAPI.Data.SetEntityData(player, "ON_DUTY", false);
                        break;
                    }
                }
                else
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник EMS", 3000);
                }
                return;

            case 19:
                if (NAPI.Player.GetPlayerHealth(player) > 99)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не нуждаетесь в лечении", 3000);
                    break;
                }
                if (player.HasData("HEAL_TIMER"))
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы уже лечитесь", 3000);
                    break;
                }
                Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы начали лечение", 3000);
                //player.SetData("HEAL_TIMER", Main.StartT(3750, 3750, (o) => healTimer(player), "HEAL_TIMER"));
                player.SetData("HEAL_TIMER", Timers.Start(3750, () => healTimer(player)));
                return;

            case 51:
                OpenTattooDeleteMenu(player);
                return;

            case 58:
                if (Main.Players[player].FractionID != 8)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник EMS", 3000);
                    break;
                }
                if (!player.IsInVehicle || !player.Vehicle.HasData("CANMEDKITS"))
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не в машине или Ваша машина не может перевозить аптечки", 3000);
                    break;
                }

                var medCount = VehicleInventory.GetCountOfType(player.Vehicle, ItemType.HealthKit);
                if (medCount >= 50)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"В машине максимум аптечек", 3000);
                    break;
                }
                if (HumanMedkitsLefts <= 0)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Аптечки закончились. Приезжайте за новыми через час", 3000);
                    break;
                }
                var toAdd = (HumanMedkitsLefts > 50 - medCount) ? 50 - medCount : HumanMedkitsLefts;
                HumanMedkitsLefts = toAdd;

                VehicleInventory.Add(player.Vehicle, new nItem(ItemType.HealthKit, toAdd));
                Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы заполнили машину аптечками", 3000);
                return;

            case 63:
                if (Main.Players[player].FractionID != 8)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник EMS", 3000);
                    break;
                }
                if (player.IsInVehicle)
                {
                    return;
                }
                if (player.Position.Z > 50)
                {
                    if (player.HasData("FOLLOWING"))
                    {
                        Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000);
                        return;
                    }
                    player.SetData("IN_HOSPITAL", true);
                    NAPI.Entity.SetEntityPosition(player, emsCheckpoints[8] + new Vector3(0, 0, 1.12));
                    Main.PlayerEnterInterior(player, emsCheckpoints[8] + new Vector3(0, 0, 1.12));
                }
                else
                {
                    if (player.HasData("FOLLOWING"))
                    {
                        Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000);
                        return;
                    }
                    player.SetData("IN_HOSPITAL", false);
                    NAPI.Entity.SetEntityPosition(player, emsCheckpoints[7] + new Vector3(0, 0, 1.12));
                    Main.PlayerEnterInterior(player, emsCheckpoints[7] + new Vector3(0, 0, 1.12));
                }
                return;
            }
        }
Exemplo n.º 3
0
        public static void loadMaterialsTimer(Client player)
        {
            NAPI.Task.Run(() =>
            {
                try
                {
                    if (!player.HasData("vehicleMats"))
                    {
                        return;
                    }
                    if (!player.IsInVehicle)
                    {
                        return;
                    }
                    Vehicle vehicle = player.GetData("vehicleMats");

                    var itemCount = VehicleInventory.GetCountOfType(player.Vehicle, ItemType.Material);
                    if (player.GetData("whereLoad") == "WAR" && !Fractions.MatsWar.isWar)
                    {
                        player.SetData("INTERACTIONCHECK", 0);
                        //Main.StopT(player.GetData("loadMatsTimer"), "loadMaterialsTimer");
                        player.ResetData("loadMatsTimer");
                        Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Корабль уже уехал", 3000);
                        return;
                    }
                    if (itemCount >= Fractions.Stocks.maxMats[vehicle.DisplayName])
                    {
                        Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"В машине максимальное кол-во материала", 3000);
                        //Main.StopT(player.GetData("loadMatsTimer"), "loadMaterialsTimer_1");
                        player.ResetData("loadMatsTimer");
                        return;
                    }
                    var data = new nItem(ItemType.Material);
                    if (player.GetData("whereLoad") == "WAR")
                    {
                        var count = Fractions.Stocks.maxMats[vehicle.DisplayName] - itemCount;
                        if (count >= Fractions.MatsWar.matsLeft)
                        {
                            data.Count = itemCount + Fractions.MatsWar.matsLeft;
                            Fractions.MatsWar.matsLeft = 0;
                            Fractions.MatsWar.endWar();
                        }
                        else
                        {
                            data.Count = count;
                            Fractions.MatsWar.matsLeft -= count;
                        }
                    }
                    else
                    {
                        data.Count = Fractions.Stocks.maxMats[vehicle.DisplayName] - itemCount;
                    }
                    VehicleInventory.Add(vehicle, data);
                    NAPI.Data.ResetEntityData(vehicle, "loaderMats");
                    //Main.StopT(player.GetData("loadMatsTimer"), "loadMaterialsTimer_2");
                    player.ResetData("loadMatsTimer");
                    Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы загрузили материалы в машину", 3000);
                }
                catch (Exception e) { Log.Write("LoadMatsTimer: " + e.Message, nLog.Type.Error); }
            });
        }
Exemplo n.º 4
0
        public static void interactPressed(Client player, int interact)
        {
            switch (interact)
            {
            case 34:
                if (Main.Players[player].FractionID != 14)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не служите в армии", 3000);
                    return;
                }
                if (!Stocks.fracStocks[14].IsOpen)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Склад закрыт", 3000);
                    return;
                }
                Trigger.ClientEvent(player, "armyguns");
                return;

            case 35:
                if (Main.Players[player].FractionID != 14)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не служите в армии", 3000);
                    return;
                }
                OpenArmyClothesMenu(player);
                return;

            case 36:
                if (Main.Players[player].FractionID != 14)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не служите в армии", 3000);
                    return;
                }
                if (!player.IsInVehicle)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны находиться в машине", 3000);
                    return;
                }
                if (!player.Vehicle.HasData("CANMATS"))
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"На этой машине нельзя перевозить маты", 3000);
                    return;
                }
                if (player.HasData("loadMatsTimer"))
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы уже загружаете материалы в машину", 3000);
                    return;
                }
                if (!Fractions.Stocks.maxMats.ContainsKey(player.Vehicle.DisplayName))
                {
                    return;
                }
                var count = VehicleInventory.GetCountOfType(player.Vehicle, ItemType.Material);
                if (count >= Fractions.Stocks.maxMats[player.Vehicle.DisplayName])
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"В машине максимальное кол-во материала", 3000);
                    return;
                }
                //player.SetData("loadMatsTimer", Main.StartT(20000, 99999999, (o) => loadMaterialsTimer(player), "ALOADMATS_TIMER"));
                player.SetData("loadMatsTimer", Timers.StartOnce(20000, () => loadMaterialsTimer(player)));
                player.Vehicle.SetData("loaderMats", player);
                Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Загрузка материалов началась (20 секунд)", 3000);
                Trigger.ClientEvent(player, "showLoader", "Загрузка материалов", 1);
                player.SetData("vehicleMats", player.Vehicle);
                player.SetData("whereLoad", "ARMY");
                return;

            case 25:
                if (player.IsInVehicle)
                {
                    return;
                }
                if (player.HasData("FOLLOWING"))
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000);
                    return;
                }
                if (player.Position.Z > 50)
                {
                    NAPI.Entity.SetEntityPosition(player, new Vector3(ArmyCheckpoints[3].X, ArmyCheckpoints[3].Y, ArmyCheckpoints[3].Z + 1));
                    Main.PlayerEnterInterior(player, new Vector3(ArmyCheckpoints[3].X, ArmyCheckpoints[3].Y, ArmyCheckpoints[3].Z + 1));
                }
                else
                {
                    NAPI.Entity.SetEntityPosition(player, new Vector3(ArmyCheckpoints[4].X, ArmyCheckpoints[4].Y, ArmyCheckpoints[4].Z + 1));
                    Main.PlayerEnterInterior(player, new Vector3(ArmyCheckpoints[4].X, ArmyCheckpoints[4].Y, ArmyCheckpoints[4].Z + 1));
                }
                return;

            case 60:     // open stock gun
                if (Main.Players[player].FractionID != 14)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не служите в армии", 3000);
                    return;
                }
                if (!NAPI.Data.GetEntityData(player, "ON_DUTY"))
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны начать рабочий день", 3000);
                    return;
                }
                if (!Stocks.fracStocks[14].IsOpen)
                {
                    Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Склад закрыт", 3000);
                    return;
                }
                player.SetData("ONFRACSTOCK", 14);
                GUI.Dashboard.OpenOut(player, Stocks.fracStocks[14].Weapons, "Склад оружия", 6);
                return;
            }
        }