Exemplo n.º 1
0
 public void SetMPReward(Client player, uint newreward)
 {
     if (Main.Players.ContainsKey(player))
     {
         if (Main.Players[player].AdminLVL >= 6)
         {
             if (newreward <= 999999)
             {
                 AdminEvent.RewardLimit = newreward;
                 try
                 {
                     MySQL.Query($"UPDATE `eventcfg` SET `RewardLimit`={newreward}");
                     Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, "Вы установили лимит на " + newreward, 3000);
                 }
                 catch (Exception e)
                 {
                     Log.Write("EXCEPTION AT \"SetMPReward\":\n" + e.ToString(), nLog.Type.Error);
                 }
             }
             else
             {
                 player.SendChatMessage("Вы ввели слишком большой лимит. Максимально возможный лимит: 999999");
             }
         }
     }
 }
Exemplo n.º 2
0
        public async Task <bool> Save(Client player)
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = "UPDATE `accounts` SET `password`=@pass,`email`=@email,`socialclub`=@sc,`redbucks`=@red,`viplvl`=@vipl,`hwid`=@hwid,`ip`=@ip," +
                                  "`vipdate`=@vipd,`character1`=@charf,`character2`=@charn,`character3`=@charm,`present`=@pres WHERE `login`=@login";
                cmd.Parameters.AddWithValue("@pass", Password);
                cmd.Parameters.AddWithValue("@email", Email);
                cmd.Parameters.AddWithValue("@sc", SocialClub);
                cmd.Parameters.AddWithValue("@red", RedBucks);
                cmd.Parameters.AddWithValue("@vipl", VipLvl);
                cmd.Parameters.AddWithValue("@hwid", HWID);
                cmd.Parameters.AddWithValue("@ip", IP);
                cmd.Parameters.AddWithValue("@vipd", MySQL.ConvertTime(VipDate));
                cmd.Parameters.AddWithValue("@charf", Characters[0]);
                cmd.Parameters.AddWithValue("@charn", Characters[1]);
                cmd.Parameters.AddWithValue("@charm", Characters[2]);
                cmd.Parameters.AddWithValue("@pres", PresentGet);
                cmd.Parameters.AddWithValue("@login", Login);
                await MySQL.QueryAsync(cmd);

                return(true);
            }
            catch (Exception e)
            {
                Log.Write("EXCEPTION AT \"Save\":\n" + e.ToString(), nLog.Type.Error);
                return(false);
            }
        }
Exemplo n.º 3
0
        public void OnResourceStartHandler()
        {
            try
            {
                Cols.Add(0, NAPI.ColShape.CreateCylinderColShape(Coords[0], 1f, 2, 0));
                Cols[0].OnEntityEnterColShape += mws_OnEntityEnterColShape;
                Cols[0].OnEntityExitColShape  += mws_OnEntityExitColShape;
                Cols[0].SetData("INTERACT", 82);

                Cols.Add(1, NAPI.ColShape.CreateCylinderColShape(Coords[1], 1f, 2, 0));
                Cols[1].OnEntityEnterColShape += mws_OnEntityEnterColShape;
                Cols[1].OnEntityExitColShape  += mws_OnEntityExitColShape;
                Cols[1].SetData("INTERACT", 83);

                Cols.Add(2, NAPI.ColShape.CreateCylinderColShape(Coords[2], 1f, 2, 0));
                Cols[2].OnEntityEnterColShape += mws_OnEntityEnterColShape;
                Cols[2].OnEntityExitColShape  += mws_OnEntityExitColShape;
                Cols[2].SetData("INTERACT", 84);

                Cols.Add(3, NAPI.ColShape.CreateCylinderColShape(Coords[3], 1f, 2, 0));
                Cols[3].OnEntityEnterColShape += mws_OnEntityEnterColShape;
                Cols[3].OnEntityExitColShape  += mws_OnEntityExitColShape;
                Cols[3].SetData("INTERACT", 85);

                NAPI.Marker.CreateMarker(1, Coords[0] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
                NAPI.Marker.CreateMarker(1, Coords[1] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
                NAPI.Marker.CreateMarker(1, Coords[2] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
                NAPI.Marker.CreateMarker(1, Coords[3] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
            } catch (Exception e)
            {
                Log.Write("EXCEPTION AT\"FRACTIONS_MERRYWEATHER\":\n" + e.ToString(), nLog.Type.Error);
            }
        }
Exemplo n.º 4
0
 public void Event_EntityDeleted(NetHandle entity)
 {
     try
     {
         if (NAPI.Entity.GetEntityType(entity) == EntityType.Vehicle && VehiclesSyncDatas.ContainsKey(entity))
         {
             VehiclesSyncDatas.Remove(entity);
         }
     }
     catch (Exception e) { Log.Write("Event_EntityDeleted: " + e.Message); }
 }
Exemplo n.º 5
0
 public void onPlayerEnterVehicle(Client player, Vehicle vehicle, sbyte seatid)
 {
     try
     {
         if ((player.HasData("HAND_MONEY") || player.HasData("HEIST_DRILL")) && player.VehicleSeat == -1 && vehicle.Class != 8)
         {
             VehicleManager.WarpPlayerOutOfVehicle(player);
             Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не можете сесть в машину с сумками", 3000);
         }
     }
     catch (Exception e) { Log.Write("PlayerEnterVehicle: " + e.Message, nLog.Type.Error); }
 }
Exemplo n.º 6
0
 public static void Event_Passport(Client player, params object[] arguments)
 {
     try
     {
         Client to = (Client)arguments[0];
         Log.Debug(to.Name.ToString());
         Passport(player, to);
     } catch (Exception e)
     {
         Log.Write("EXCEPTION AT \"EVENT_PASSPORT\":\n" + e.ToString(), nLog.Type.Error);
     }
 }
Exemplo n.º 7
0
 public void Event_onPlayerEnterVehicleHandler(Client player, Vehicle vehicle, sbyte seatid)
 {
     try
     {
         if (NAPI.Data.GetEntityData(vehicle, "TYPE") != "MECHANIC")
         {
             return;
         }
         if (seatid == -1)
         {
             if (!Main.Players[player].Licenses[1])
             {
                 Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас нет лицензии категории B", 3000);
                 VehicleManager.WarpPlayerOutOfVehicle(player);
                 return;
             }
             if (Main.Players[player].WorkID == 8)
             {
                 if (NAPI.Data.GetEntityData(player, "WORK") == null)
                 {
                     if (vehicle.GetData("DRIVER") != null)
                     {
                         Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Этот рабочий транспорт уже занят", 3000);
                         return;
                     }
                     if (Main.Players[player].Money >= mechanicRentCost)
                     {
                         Trigger.ClientEvent(player, "openDialog", "MECHANIC_RENT", $"Арендовать рабочий транспорт за ${mechanicRentCost}?");
                     }
                     else
                     {
                         Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас не хватает " + (mechanicRentCost - Main.Players[player].Money) + "$ на аренду рабочего транспорта", 3000);
                         VehicleManager.WarpPlayerOutOfVehicle(player);
                     }
                 }
                 else if (NAPI.Data.GetEntityData(player, "WORK") == vehicle)
                 {
                     NAPI.Data.SetEntityData(player, "IN_WORK_CAR", true);
                 }
                 else
                 {
                     Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы уже работаете", 3000);
                 }
             }
             else
             {
                 Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не работаете автомехаником. Устроиться можно в мэрии", 3000);
                 VehicleManager.WarpPlayerOutOfVehicle(player);
             }
         }
     }
     catch (Exception e) { Log.Write("PlayerEnterVehicle: " + e.Message, nLog.Type.Error); }
 }
Exemplo n.º 8
0
        public static void Online(Client client, DateTime until, bool ishard, string reason, string admin)
        {
            var acc = Main.Players[client];

            if (acc == null)
            {
                Log.Write($"Can't ban player {client.Name}", nLog.Type.Error);
                return;
            }
            Ban ban = new Ban()
            {
                UUID       = acc.UUID,
                Name       = acc.FirstName + "_" + acc.LastName,
                Account    = Main.Accounts[client].Login,
                Time       = DateTime.Now,
                Until      = until,
                isHard     = ishard,
                IP         = client.Address,
                SocialClub = client.GetData("RealSocialClub"),
                HWID       = client.GetData("RealHWID"),
                Reason     = reason,
                ByAdmin    = admin
            };

            MySQL.Query("INSERT INTO `banned`(`uuid`,`name`,`account`,`time`,`until`,`ishard`,`ip`,`socialclub`,`hwid`,`reason`,`byadmin`) " +
                        $"VALUES ({ban.UUID},'{ban.Name}','{ban.Account}','{MySQL.ConvertTime(ban.Time)}','{MySQL.ConvertTime(ban.Until)}',{ban.isHard},'{ban.IP}','{ban.SocialClub}','{ban.HWID}','{ban.Reason}','{ban.ByAdmin}')");
            Banned.Add(ban);
        }
Exemplo n.º 9
0
        public static void RespawnFractionCar(Vehicle vehicle)
        {
            try
            {
                var    canmats  = vehicle.HasData("CANMATS");
                var    candrugs = vehicle.HasData("CANDRUGS");
                var    canmeds  = vehicle.HasData("CANMEDKITS");
                string number   = vehicle.NumberPlate;
                int    fraction = vehicle.GetData("FRACTION");

                NAPI.Entity.SetEntityPosition(vehicle, FractionVehicles[fraction][number].Item2);
                NAPI.Entity.SetEntityRotation(vehicle, FractionVehicles[fraction][number].Item3);
                VehicleManager.RepairCar(vehicle);
                NAPI.Data.SetEntityData(vehicle, "ACCESS", "FRACTION");
                NAPI.Data.SetEntityData(vehicle, "FRACTION", fraction);
                NAPI.Data.SetEntityData(vehicle, "MINRANK", FractionVehicles[fraction][number].Item4);
                if (canmats)
                {
                    NAPI.Data.SetEntityData(vehicle, "CANMATS", true);
                }
                if (candrugs)
                {
                    NAPI.Data.SetEntityData(vehicle, "CANDRUGS", true);
                }
                if (canmeds)
                {
                    NAPI.Data.SetEntityData(vehicle, "CANMEDKITS", true);
                }
                NAPI.Vehicle.SetVehicleNumberPlate(vehicle, number);
                Core.VehicleStreaming.SetEngineState(vehicle, false);
                VehicleManager.FracApplyCustomization(vehicle, fraction);
            }
            catch (Exception e) { Log.Write("RespawnFractionCar: " + e.Message, nLog.Type.Error); }
        }
Exemplo n.º 10
0
 public void onResourceStart()
 {
     try
     {
         int i = 0;
         foreach (var vec in warPoints)
         {
             warPointColshape.Add(NAPI.ColShape.CreateCylinderColShape(vec, 100, 10, 0));
             warPointColshape[i].SetData("ID", i);
             warPointColshape[i].OnEntityEnterColShape += onPlayerEnterBizWar;
             warPointColshape[i].OnEntityExitColShape  += onPlayerExitBizWar;
             warBlips.Add(i, NAPI.Blip.CreateBlip(543, vec, 1, 40, Main.StringToU16("War for business"), 255, 0, true, 0, 0));
             i++;
         }
     }
     catch (Exception e) { Log.Write("ResourceStart: " + e.Message, nLog.Type.Error); }
 }
Exemplo n.º 11
0
 public void onResourceStart()
 {
     try
     {
         Log.Write("Loading ATMs...");
         for (int i = 0; i < ATMs.Count; i++)
         {
             ATMCols.Add(i, NAPI.ColShape.CreateCylinderColShape(ATMs[i], 1, 2, 0));
             ATMCols[i].SetData("NUMBER", i);
             ATMCols[i].OnEntityEnterColShape += (s, e) => {
                 try
                 {
                     e.SetData("INTERACTIONCHECK", 13);
                     Jobs.Collector.CollectorEnterATM(e, s);
                 }
                 catch (Exception ex) { Log.Write("ATMCols.OnEntityEnterColShape: " + ex.Message, nLog.Type.Error); }
             };
             ATMCols[i].OnEntityExitColShape += (s, e) => {
                 try
                 {
                     e.SetData("INTERACTIONCHECK", 0);
                 }
                 catch (Exception ex) { Log.Write("ATMCols.OnEntityExitrColShape: " + ex.Message, nLog.Type.Error); }
             };
         }
     }
     catch (Exception e) { Log.Write("ResourceStart: " + e.Message, nLog.Type.Error); }
 }
Exemplo n.º 12
0
        public void onResourceStart()
        {
            try
            {
                Cols.Add(0, NAPI.ColShape.CreateCylinderColShape(Points[0], 1, 2, 0));                                                            // job placement
                Cols[0].OnEntityEnterColShape += JobMenu_onEntityEnterColShape;                                                                   // job placement point handler
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~g~Устройство на Работы."), new Vector3(Points[0].X, Points[0].Y, Points[0].Z + 0.5), 10F, 0.3F, 0, new Color(255, 255, 255));
                NAPI.Marker.CreateMarker(1, Points[0] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1f, new Color(255, 255, 255, 220)); // Не работает СТОИТ ИЗМЕНЯТЬ


                // blips
                NAPI.Blip.CreateBlip(354, new Vector3(724.9625, 133.9959, 79.83643), 1.5f, 46, Main.StringToU16("Power Station"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(408, new Vector3(105.4633, -1568.843, 28.60269), 1, 3, Main.StringToU16("Postal"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(198, new Vector3(903.3215, -191.7, 73.40494), 1, 46, Main.StringToU16("Taxi"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(198, new Vector3(1956.65015, 3769.12817, 31.0833454), 1, 46, Main.StringToU16("Taxi"), 255, 0, true, 0, 0);//TODOTAXI
                NAPI.Blip.CreateBlip(198, new Vector3(1791.82837, 4586.595, 36.2361145), 1, 46, Main.StringToU16("Taxi"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(513, new Vector3(462.6476, -605.5295, 27.49518), 1, 30, Main.StringToU16("Bus"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(512, new Vector3(-1331.475, 53.58579, 53.53268), 1, 2, Main.StringToU16("Lanwmower"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(477, new Vector3(588.2037, -3037.641, 6.303829), 1, 4, Main.StringToU16("Trucker"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(477, new Vector3(338.9279, 3417.426, 35.38838), 1, 4, Main.StringToU16("Trucker"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(477, new Vector3(-2212.77, 4249.193, 46.17959), 1, 4, Main.StringToU16("Trucker"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(67, new Vector3(915.9069, -1265.255, 25.52912), 1, 63, Main.StringToU16("Collector"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(67, new Vector3(-1481.75537, -508.08847, 31.6868382), 1, 63, Main.StringToU16("Collector"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(67, new Vector3(-144.374817, 6354.90869, 30.3706112), 1, 63, Main.StringToU16("Collector"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(446, new Vector3(473.9508, -1275.597, 29.60513), 1, 40, Main.StringToU16("Auto Mechanic"), 255, 0, true, 0, 0);

                NAPI.Blip.CreateBlip(225, new Vector3(-501.78833, 61.4290543, 56.57218), 1, 33, Main.StringToU16("Rent-a-Car"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(495, new Vector3(-1108.662, -1690.129, 3.254202), 1, 84, Main.StringToU16("Rent-a-Cycle"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(471, new Vector3(-1625.545, -1164.137, 0.2994334), 1, 38, Main.StringToU16("Rent-a-Boat"), 255, 0, true, 0, 0);

                NAPI.Blip.CreateBlip(80, Truckers.getProduct[0], 1, 84, Main.StringToU16("Products stock"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(80, Truckers.getProduct[1], 1, 36, Main.StringToU16("Fuel stock"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(80, Truckers.getProduct[2], 1, 15, Main.StringToU16("Auto stock"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(80, Truckers.getProduct[3], 1, 62, Main.StringToU16("Guns stock"), 255, 0, true, 0, 0);

                NAPI.Blip.CreateBlip(603, new Vector3(-2350.931, 3270.689, 40.95937), 1, 31, Main.StringToU16("Army"), 255, 0, true, 0, 0);
                NAPI.Blip.CreateBlip(181, new Vector3(-2397.011, -1777.352, 8.353774), 1, 46, Main.StringToU16("Dubai"), 255, 0, true, 0, 0);

                // markers
                NAPI.Marker.CreateMarker(1, new Vector3(105.4633, -1568.843, 28.60269) - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1f, new Color(255, 255, 255, 220)); // new Vector3(105.4633, -1568.843, 28.60269)
                NAPI.Marker.CreateMarker(1, new Vector3(106.2007, -1563.748, 28.60272) - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1f, new Color(255, 255, 255, 220)); // new Vector3(106.2007, -1563.748, 28.60272)
                NAPI.Marker.CreateMarker(1, new Vector3(-0.51, -436.71, 38.74) - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1f, new Color(255, 255, 255, 220));         // new Vector3(-0.51, -436.71, 38.74)
            } catch (Exception e) { Log.Write("ResourceStart: " + e.Message, nLog.Type.Error); }
        }
Exemplo n.º 13
0
        public static Vector3 CarSpawnRot = new Vector3(-0.05113003, 0.05638388, 91.65826); // Rotation для спавна машины в автосалоне

        public static void onPlayerDissonnectedHandler(Client player, DisconnectionType type, string reason)
        {
            try
            {
                if (NAPI.Data.GetEntityData(player, "CARROOM_CAR") != null)
                {
                    var veh = NAPI.Data.GetEntityData(player, "CARROOM_CAR");
                    NAPI.Task.Run(() =>
                    {
                        try
                        {
                            NAPI.Entity.DeleteEntity(veh);
                        }
                        catch (Exception e) { Log.Write("CarRoom entity delete: " + e.Message); }
                    });
                }
            }
            catch (Exception e) { Log.Write("PlayerDisconnected: " + e.Message, nLog.Type.Error); }
        }
Exemplo n.º 14
0
        public FurnitureManager()
        {
            var result = MySQL.QueryRead($"SELECT * FROM `furniture`");

            if (result == null || result.Rows.Count == 0)
            {
                Log.Write("DB return null result.", nLog.Type.Warn);
                return;
            }
            foreach (DataRow Row in result.Rows)
            {
                Dictionary <int, HouseFurniture> furnitures = JsonConvert.DeserializeObject <Dictionary <int, HouseFurniture> >(Row["furniture"].ToString());
                Dictionary <int, List <nItem> >  items      = JsonConvert.DeserializeObject <Dictionary <int, List <nItem> > >(Row["data"].ToString());
                int id = Convert.ToInt32(Row["uuid"].ToString());
                HouseFurnitures.Add(id, furnitures);
                FurnituresItems.Add(id, items);
            }
            Log.Write($"Loaded {HouseFurnitures.Count} players furnitures.", nLog.Type.Success);
        }
Exemplo n.º 15
0
 public void ArmedBody_Exit()
 {
     try
     {
         foreach (Client player in NAPI.Pools.GetAllPlayers())
         {
             RemoveWeaponProps(player);
         }
     }
     catch (Exception e) { Log.Write("ResourceStop: " + e.Message, nLog.Type.Error); }
 }
Exemplo n.º 16
0
        public static void CreateSafeZone(Vector3 position, int height, int width)
        {
            var colShape = NAPI.ColShape.Create2DColShape(position.X, position.Y, height, width, 0);

            colShape.OnEntityEnterColShape += (shape, player) =>
            {
                try
                {
                    Trigger.ClientEvent(player, "safeZone", true);
                }
                catch (Exception e) { Log.Write($"SafeZoneEnter: {e.Message}", nLog.Type.Error); }
            };
            colShape.OnEntityExitColShape += (shape, player) =>
            {
                try
                {
                    Trigger.ClientEvent(player, "safeZone", false);
                }
                catch (Exception e) { Log.Write($"SafeZoneExit: {e.Message}", nLog.Type.Error); }
            };
        }
Exemplo n.º 17
0
        private static void order_onEntityExit(ColShape shape, Client player)
        {
            try
            {
                if (shape.GetData("PASSAGER") != player)
                {
                    return;
                }

                if (player.HasData("TAXI_DRIVER"))
                {
                    Client driver = player.GetData("TAXI_DRIVER");
                    driver.ResetData("PASSAGER");
                    player.ResetData("TAXI_DRIVER");
                    player.SetData("IS_CALL_TAXI", false);
                    Notify.Send(driver, NotifyType.Warning, NotifyPosition.BottomCenter, $"Пассажир отменил заказ", 3000);
                    Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы покинули место вызова такси", 3000);
                    try
                    {
                        NAPI.ColShape.DeleteColShape(orderCols[player]);
                        orderCols.Remove(player);
                    }
                    catch { }
                }
            }
            catch (Exception ex) { Log.Write("order_onEntityExit: " + ex.Message, nLog.Type.Error); }
        }
Exemplo n.º 18
0
        public void onResourceStart()
        {
            try
            {
                Cols.Add(0, NAPI.ColShape.CreateCylinderColShape(Coords[0], 1, 2, 0)); // start work
                Cols[0].OnEntityEnterColShape += gp_onEntityEnterColShape;
                Cols[0].OnEntityExitColShape  += gp_onEntityExitColShape;
                Cols[0].SetData("INTERACT", 28);
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("Postal stock"), Coords[0] + new Vector3(0, 0, 0.3), 10F, 0.6F, 0, new Color(0, 180, 0));

                Cols.Add(1, NAPI.ColShape.CreateCylinderColShape(Coords[1], 1, 2, 0)); // get car
                Cols[1].OnEntityEnterColShape += gp_onEntityEnterColShape;
                Cols[1].OnEntityExitColShape  += gp_onEntityExitColShape;
                Cols[1].SetData("INTERACT", 29);
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("Take work car"), Coords[1] + new Vector3(0, 0, 0.3), 10F, 0.6F, 0, new Color(0, 180, 0));
            } catch (Exception e) { Log.Write("ResourceStart: " + e.Message, nLog.Type.Error); }
        }
Exemplo n.º 19
0
 public static void DismissPrivateDimension(Client requester)
 {
     try
     {
         foreach (KeyValuePair <int, NetHandle> dim in DimensionsInUse)
         {
             if (dim.Value == requester.Handle)
             {
                 DimensionsInUse.Remove(dim.Key);
             }
             break;
         }
     }
     catch (Exception e) { Log.Write("DismissPrivateDimension: " + e.Message, nLog.Type.Error); }
 }
Exemplo n.º 20
0
 public static void Event_OnPlayerDisconnected(Client client, DisconnectionType type, string reason)
 {
     try
     {
         if (Menus.ContainsKey(client.Handle))
         {
             Menus.Remove(client.Handle);
         }
     }
     catch (Exception e) { Log.Write("PlayerDisconnected: " + e.Message, nLog.Type.Error); }
 }
Exemplo n.º 21
0
 public void Event_ResourceStart()
 {
     try
     {
         var col = NAPI.ColShape.CreateCylinderColShape(TakeMoneyPos, 1, 3, 0);
         col.OnEntityEnterColShape += (s, e) => {
             try
             {
                 e.SetData("INTERACTIONCHECK", 45);
             }
             catch (Exception ex) { Log.Write("col.OnEntityEnterColShape: " + ex.Message, nLog.Type.Error); }
         };
         col.OnEntityExitColShape += (s, e) => {
             try
             {
                 e.SetData("INTERACTIONCHECK", 0);
             }
             catch (Exception ex) { Log.Write("col.OnEntityExitColShape: " + ex.Message, nLog.Type.Error); }
         };
         NAPI.Marker.CreateMarker(1, TakeMoneyPos - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220), false, 0);
         NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~b~Нажмите Е, чтобы забрать деньги"), TakeMoneyPos + new Vector3(0, 0, 0.3), 30f, 0.4f, 0, new Color(255, 255, 255), true, 0);
     }
     catch (Exception e) { Log.Write("ResourceStart: " + e.Message, nLog.Type.Error); }
 }
Exemplo n.º 22
0
        public void OnResourceStartHandler()
        {
            try
            {
                Cols.Add(0, NAPI.ColShape.CreateCylinderColShape(LSNewsCoords[0], 1f, 2, 0));
                Cols[0].OnEntityEnterColShape += lsnews_OnEntityEnterColShape;
                Cols[0].OnEntityExitColShape  += lsnews_OnEntityExitColShape;
                Cols[0].SetData("INTERACT", 80);

                Cols.Add(1, NAPI.ColShape.CreateCylinderColShape(LSNewsCoords[1], 1f, 2, 0));
                Cols[1].OnEntityEnterColShape += lsnews_OnEntityEnterColShape;
                Cols[1].OnEntityExitColShape  += lsnews_OnEntityExitColShape;
                Cols[1].SetData("INTERACT", 81);

                NAPI.Marker.CreateMarker(1, LSNewsCoords[0] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
                NAPI.Marker.CreateMarker(1, LSNewsCoords[1] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
            } catch (Exception e)
            {
                Log.Write("EXCEPTION AT\"FRACTIONS_LSNEWS\":\n" + e.ToString(), nLog.Type.Error);
            }
        }
Exemplo n.º 23
0
        public static void Init()
        {
            try
            {
                Reports = new Dictionary <int, Report>();

                string cmd = @"
CREATE TABLE IF NOT EXISTS `questions` (
  `ID` int(12) unsigned NOT NULL AUTO_INCREMENT,
  `Author` varchar(40) NOT NULL,
  `Question` varchar(150) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `Respondent` varchar(40) DEFAULT NULL,
  `Response` varchar(150) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `Opened` datetime NOT NULL,
  `Closed` datetime DEFAULT NULL,
  `Status` tinyint(4) DEFAULT 0,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
SELECT * FROM questions;";

                DataTable result = MySQL.QueryRead(cmd);
                if (result is null)
                {
                    return;
                }
                foreach (DataRow row in result.Rows)
                {
                    if (Convert.ToBoolean((sbyte)row[7]) != false)
                    {
                        continue;
                    }

                    Reports.Add((int)row[0], new Report
                    {
                        ID         = (int)row[0],
                        Author     = row[1].ToString(),
                        Question   = Main.BlockSymbols(row[2].ToString()),
                        BlockedBy  = row[3].ToString(),
                        Response   = Main.BlockSymbols(row[4].ToString()),
                        OpenedDate = (DateTime)row[5],
                        ClosedDate = (DateTime)row[6],
                        Status     = Convert.ToBoolean((sbyte)row[7])
                    });
                }
            } catch (Exception e)
            {
                Log.Write("Init: " + e.ToString(), nLog.Type.Error);
            }
        }
Exemplo n.º 24
0
        public void onResourceStartHandler()
        {
            try
            {
                MowerWaysCols.Add(new Dictionary <int, ColShape>());
                MowerWaysCols.Add(new Dictionary <int, ColShape>());
                MowerWaysCols.Add(new Dictionary <int, ColShape>());

                for (int i = 0; i < MowerWays.Count; i++)
                {
                    for (int d = 0; d < MowerWays[i].Count; d++)
                    {
                        MowerWaysCols[i].Add(d, NAPI.ColShape.CreateCylinderColShape(MowerWays[i][d], 2.5F, 2, 0));
                        MowerWaysCols[i][d].OnEntityEnterColShape += mowerCheckpointEnterWay;
                        MowerWaysCols[i][d].SetData("WAY", i);
                        MowerWaysCols[i][d].SetData("NUMBER", d);
                    }
                }
            } catch (Exception e) { Log.Write("ResourceStart: " + e.Message, nLog.Type.Error); }
        }
Exemplo n.º 25
0
        public void Event_ResourceStart()
        {
            try
            {
                var result = MySQL.QueryRead("SELECT * FROM `weapons`");
                if (result == null || result.Rows.Count == 0)
                {
                    Log.Write("Table 'weapons' returns null result", nLog.Type.Warn);
                    return;
                }
                foreach (DataRow Row in result.Rows)
                {
                    var id         = Convert.ToInt32(Row["id"]);
                    var lastserial = Convert.ToInt32(Row["lastserial"]);

                    BusinessesLastSerial.Add(id, lastserial);
                }
            }
            catch (Exception e) { Log.Write("ResourceStart: " + e.Message, nLog.Type.Error); }
        }
Exemplo n.º 26
0
        public void onResourceStart()
        {
            try
            {
                var result = MySQL.QueryRead($"SELECT * FROM `garages`");
                if (result == null || result.Rows.Count == 0)
                {
                    Log.Write("DB return null result.", nLog.Type.Warn);
                    return;
                }
                foreach (DataRow Row in result.Rows)
                {
                    /*Garage garage = JsonConvert.DeserializeObject<Garage>(Row["data"].ToString());
                     * garage.Dimension = DimensionID;
                     * if (garage.Type != -1) garage.CreateInterior();
                     *
                     * Garages.Add(Convert.ToInt32(Row["id"]), garage);
                     * DimensionID++;
                     *
                     * MySQL.Query($"UPDATE `garages` SET type={garage.Type}, position='{JsonConvert.SerializeObject(garage.Position)}', rotation='{JsonConvert.SerializeObject(garage.Rotation)}' WHERE id={garage.ID}");*/

                    var id       = Convert.ToInt32(Row["id"]);
                    var type     = Convert.ToInt32(Row["type"]);
                    var position = JsonConvert.DeserializeObject <Vector3>(Row["position"].ToString());
                    var rotation = JsonConvert.DeserializeObject <Vector3>(Row["rotation"].ToString());

                    var garage = new Garage(id, type, position, rotation);
                    garage.Dimension = DimensionID;
                    if (garage.Type != -1)
                    {
                        garage.CreateInterior();
                    }

                    Garages.Add(id, garage);
                    DimensionID++;
                }
                Log.Write($"Loaded {Garages.Count} garages.", nLog.Type.Success);
            } catch (Exception e) { Log.Write($"ResourceStart: " + e.Message, nLog.Type.Error); }
        }
Exemplo n.º 27
0
        private static void Worker()
        {
            string CMD = "";

            try
            {
                Log.Debug("Worker started");
                while (true)
                {
                    if (queue.Count < 1)
                    {
                        continue;
                    }
                    else
                    {
                        MySQL.Query(queue.Dequeue());
                    }
                }
            }
            catch (Exception e)
            {
                Log.Write($"{e.ToString()}\n{CMD}", nLog.Type.Error);
            }
        }
Exemplo n.º 28
0
        public void onResourceStart()
        {
            try
            {
                var shape = NAPI.ColShape.CreateCylinderColShape(enterSchool, 1, 2, 0);
                shape.OnEntityEnterColShape += onPlayerEnterSchool;
                shape.OnEntityExitColShape  += onPlayerExitSchool;

                NAPI.Marker.CreateMarker(1, enterSchool - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~b~Автошкола"), new Vector3(enterSchool.X, enterSchool.Y, enterSchool.Z + 1), 5f, 0.3f, 0, new Color(255, 255, 255));
                var blip = NAPI.Blip.CreateBlip(enterSchool, 0);
                blip.ShortRange = true;
                blip.Name       = Main.StringToU16("Автошкола");
                blip.Sprite     = 545;
                blip.Color      = 29;
                for (int i = 0; i < drivingCoords.Count; i++)
                {
                    var colshape = NAPI.ColShape.CreateCylinderColShape(drivingCoords[i], 4, 5, 0);
                    colshape.OnEntityEnterColShape += onPlayerEnterDrive;
                    colshape.SetData("NUMBER", i);
                }
            }
            catch (Exception e) { Log.Write("ResourceStart: " + e.Message, nLog.Type.Error); }
        }
Exemplo n.º 29
0
        private static void Tick(object state)
        {
            try
            {
                Log.Debug("Donate time");

                using (MySqlConnection connection = new MySqlConnection(Connection))
                {
                    connection.Open();

                    MySqlCommand command = new MySqlCommand();
                    command.Connection = connection;

                    while (toChange.Count > 0)
                    {
                        KeyValuePair <string, string> kvp = toChange.Dequeue();
                        command.CommandText = string.Format(CHNGSTR, kvp.Value, kvp.Key, Main.oldconfig.ServerNumber);
                        command.ExecuteNonQuery();
                    }

                    while (newNames.Count > 0)
                    {
                        string nickname = newNames.Dequeue();
                        command.CommandText = string.Format(NEWNSTR, Main.oldconfig.ServerNumber, nickname);
                        command.ExecuteNonQuery();
                    }

                    command.CommandText = SYNCSTR;
                    MySqlDataReader reader = command.ExecuteReader();

                    DataTable result = new DataTable();
                    result.Load(reader);
                    reader.Close();

                    foreach (DataRow Row in result.Rows)
                    {
                        int    id   = Convert.ToInt32(Row["id"]);
                        string name = Convert.ToString(Row["account"]).ToLower();
                        long   reds = Convert.ToInt64(Row["amount"]);

                        try
                        {
                            if (Main.oldconfig.DonateSaleEnable)
                            {
                                reds = SaleEvent(reds);
                            }

                            if (!Main.Usernames.Contains(name))
                            {
                                Log.Write($"Can't find registred name for {name}!", nLog.Type.Warn);
                                continue;
                            }

                            var client = Main.Accounts.FirstOrDefault(a => a.Value.Login == name).Key;
                            if (client == null || client.IsNull || !Main.Accounts.ContainsKey(client))
                            {
                                MySQL.Query($"update `accounts` set `redbucks`=`redbucks`+{reds} where `login`='{name}'");
                            }
                            else
                            {
                                lock (Main.Players)
                                {
                                    Main.Accounts[client].RedBucks += reds;
                                }
                                NAPI.Task.Run(() =>
                                {
                                    try
                                    {
                                        if (!Main.Accounts.ContainsKey(client))
                                        {
                                            return;
                                        }
                                        Notify.Send(client, NotifyType.Success, NotifyPosition.BottomCenter, $"Вам пришли {reds} Redbucks", 3000);
                                        Trigger.ClientEvent(client, "starset", Main.Accounts[client].RedBucks);
                                    }
                                    catch { }
                                });
                            }
                            //TODO: новый лог денег
                            //GameLog.Money("donate", $"player({Main.PlayerUUIDs[name]})", +stars);
                            GameLog.Money("server", name, reds, "donateRed");

                            command.CommandText = $"delete from completed where id={id}";
                            command.ExecuteNonQuery();
                        }
                        catch (Exception e)
                        {
                            Log.Write($"Exception At Tick_Donations on {name}:\n" + e.ToString(), nLog.Type.Error);
                        }
                    }
                    connection.Close();
                }
            }
            catch (Exception e)
            {
                Log.Write("Exception At Tick_Donations:\n" + e.ToString(), nLog.Type.Error);
            }
        }
Exemplo n.º 30
0
        public void onResourceStart()
        {
            try
            {
                NAPI.TextLabel.CreateTextLabel("~g~Bdesma Katsuni", new Vector3(251.4247, -1346.499, 25.5378), 5f, 0.3f, 0, new Color(255, 255, 255), true, NAPI.GlobalDimension);
                NAPI.TextLabel.CreateTextLabel("~g~Steve Hobs", new Vector3(262.3232, -1359.772, 25.53779), 5f, 0.3f, 0, new Color(255, 255, 255), true, NAPI.GlobalDimension);
                NAPI.TextLabel.CreateTextLabel("~g~Billy Bob", new Vector3(257.5671, -1344.612, 25.54937), 5f, 0.3f, 0, new Color(255, 255, 255), true, NAPI.GlobalDimension);

                #region cols
                var col = NAPI.ColShape.CreateCylinderColShape(emsCheckpoints[0], 1, 2, 0); // enter ems
                col.SetData("INTERACT", 15);
                col.OnEntityEnterColShape += emsShape_onEntityEnterColShape;
                col.OnEntityExitColShape  += emsShape_onEntityExitColShape;
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~g~Press E"), new Vector3(emsCheckpoints[0].X, emsCheckpoints[0].Y, emsCheckpoints[0].Z + 1), 5F, 0.3F, 0, new Color(255, 255, 255));
                NAPI.Marker.CreateMarker(21, emsCheckpoints[0] + new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 0.8f, new Color(255, 255, 255, 60));

                col = NAPI.ColShape.CreateCylinderColShape(emsCheckpoints[1], 1, 2, 0); // exit ems
                col.SetData("INTERACT", 16);
                col.OnEntityEnterColShape += emsShape_onEntityEnterColShape;
                col.OnEntityExitColShape  += emsShape_onEntityExitColShape;
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~g~Press E"), new Vector3(emsCheckpoints[1].X, emsCheckpoints[1].Y, emsCheckpoints[1].Z + 1), 5F, 0.3F, 0, new Color(255, 255, 255));
                NAPI.Marker.CreateMarker(21, emsCheckpoints[1] + new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 0.8f, new Color(255, 255, 255, 60));

                col = NAPI.ColShape.CreateCylinderColShape(emsCheckpoints[3], 1, 2, 0); // open hospital stock
                col.SetData("INTERACT", 17);
                col.OnEntityEnterColShape += emsShape_onEntityEnterColShape;
                col.OnEntityExitColShape  += emsShape_onEntityExitColShape;
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~g~Open stock"), new Vector3(emsCheckpoints[3].X, emsCheckpoints[3].Y, emsCheckpoints[3].Z + 0.3), 5F, 0.3F, 0, new Color(255, 255, 255));

                col = NAPI.ColShape.CreateCylinderColShape(emsCheckpoints[4], 1, 2, 0); // duty change
                col.SetData("INTERACT", 18);
                col.OnEntityEnterColShape += emsShape_onEntityEnterColShape;
                col.OnEntityExitColShape  += emsShape_onEntityExitColShape;
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~g~Press E, to change clothes"), new Vector3(emsCheckpoints[4].X, emsCheckpoints[4].Y, emsCheckpoints[4].Z + 0.3), 5F, 0.3F, 0, new Color(255, 255, 255));

                col = NAPI.ColShape.CreateCylinderColShape(emsCheckpoints[5], 1, 2, 0); // start heal course
                col.SetData("INTERACT", 19);
                col.OnEntityEnterColShape += emsShape_onEntityEnterColShape;
                col.OnEntityExitColShape  += emsShape_onEntityExitColShape;
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~g~Start healing course"), new Vector3(emsCheckpoints[5].X, emsCheckpoints[5].Y, emsCheckpoints[5].Z + 0.3), 5F, 0.3F, 0, new Color(255, 255, 255));

                col = NAPI.ColShape.CreateCylinderColShape(emsCheckpoints[6], 1, 2, 0); // tattoo delete
                col.SetData("INTERACT", 51);
                col.OnEntityEnterColShape += emsShape_onEntityEnterColShape;
                col.OnEntityExitColShape  += emsShape_onEntityExitColShape;
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~g~Tattoo Delete"), new Vector3(emsCheckpoints[6].X, emsCheckpoints[6].Y, emsCheckpoints[6].Z + 0.3), 5F, 0.3F, 0, new Color(255, 255, 255));

                col = NAPI.ColShape.CreateCylinderColShape(new Vector3(261.7316, -1352.62, 23.4178), 53, 7, 0); // start heal course
                col.OnEntityEnterColShape += (s, e) =>
                {
                    try
                    {
                        e.SetData("IN_HOSPITAL", true);
                    } catch { }
                };

                #region Load Medkits
                col = NAPI.ColShape.CreateCylinderColShape(new Vector3(3595.796, 3661.733, 32.75175), 4, 5, 0); // take meds
                col.SetData("INTERACT", 58);
                col.OnEntityEnterColShape += emsShape_onEntityEnterColShape;
                col.OnEntityExitColShape  += emsShape_onEntityExitColShape;
                NAPI.Marker.CreateMarker(1, new Vector3(3595.796, 3661.733, 29.75175), new Vector3(), new Vector3(), 4, new Color(255, 0, 0));

                col = NAPI.ColShape.CreateCylinderColShape(new Vector3(3597.154, 3670.129, 32.75175), 1, 2, 0); // take meds
                col.SetData("INTERACT", 58);
                col.OnEntityEnterColShape += emsShape_onEntityEnterColShape;
                col.OnEntityExitColShape  += emsShape_onEntityExitColShape;
                NAPI.Marker.CreateMarker(1, new Vector3(3597.154, 3670.129, 29.75175), new Vector3(), new Vector3(), 4, new Color(255, 0, 0));
                NAPI.Blip.CreateBlip(535, new Vector3(3588.917, 3661.756, 41.48687), 1, 15, "MedKits", 255, 0, true);
                #endregion

                col = NAPI.ColShape.CreateCylinderColShape(emsCheckpoints[7], 1, 2, 0); // roof
                col.SetData("INTERACT", 63);
                col.OnEntityEnterColShape += emsShape_onEntityEnterColShape;
                col.OnEntityExitColShape  += emsShape_onEntityExitColShape;
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~g~To hospital"), new Vector3(emsCheckpoints[7].X, emsCheckpoints[7].Y, emsCheckpoints[7].Z + 0.3), 5F, 0.3F, 0, new Color(255, 255, 255));

                col = NAPI.ColShape.CreateCylinderColShape(emsCheckpoints[8], 1, 2, 0); // to roof
                col.SetData("INTERACT", 63);
                col.OnEntityEnterColShape += emsShape_onEntityEnterColShape;
                col.OnEntityExitColShape  += emsShape_onEntityExitColShape;
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~g~To roof"), new Vector3(emsCheckpoints[8].X, emsCheckpoints[8].Y, emsCheckpoints[8].Z + 0.3), 5F, 0.3F, 0, new Color(255, 255, 255));

                #endregion

                for (int i = 3; i < emsCheckpoints.Count; i++)
                {
                    Marker marker = NAPI.Marker.CreateMarker(1, emsCheckpoints[i] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
                }
            }
            catch (Exception e) { Log.Write("ResourceStart: " + e.Message, nLog.Type.Error); }
        }