private static void HandleInitialDuty(string serializedDutyDictionary)
        {
            try
            {
                Dictionary <int, Duty> initialDuty = Helpers.MsgPack.Deserialize <Dictionary <int, Duty> >(serializedDutyDictionary);
                initialDuty.ToList().ForEach(d =>
                {
                    try
                    {
                        var player = otherPlayerList.Where(p => p.CharID == d.Key).First().Player;
                        CitizenFX.Core.Vehicle dutyVehicle = null;
                        Blip blip = null;

                        if (player.Character.IsInVehicle())
                        {
                            dutyVehicle       = player.Character.CurrentVehicle;
                            blip              = dutyVehicle.AttachBlip();
                            blip.IsShortRange = true;
                            blip.Sprite       = DutyConstants[d.Value].Item1;
                            blip.Color        = DutyConstants[d.Value].Item2;
                        }
                        duty.Add(d.Key, new Tuple <CitizenFX.Core.Player, Duty, CitizenFX.Core.Vehicle, Blip>(player, d.Value, dutyVehicle, blip));
                    }
                    catch (Exception ex)
                    {
                        Log.Error($"HandleInitialDuty (inner) Error: {ex.Message}");
                    }
                });
            }
            catch (Exception ex)
            {
                Log.Error($"DutyManager HandleInitialDuty Error: {ex.Message}");
            }
        }
Пример #2
0
        private void getRandomVehicle()
        {
            if (currentJobVehicle != null || currentTowTruck == null)
            {
                return;
            }
            currentJobVehicle = new VehicleList().Select(o =>
                                                         new CitizenFX.Core.Vehicle(o)).FirstOrDefault(o => o.Position.DistanceToSquared(Game.PlayerPed.Position) < 50000.0f &&
                                                                                                       o.Occupants.Length == 0 &&
                                                                                                       (!o.HasDecor("Vehicle.ID") || o.HasDecor("Vehicle.ID") && o.GetDecor <int>("Vehicle.ID") >= 1000000) &&
                                                                                                       o.Position.DistanceToSquared(towDropoffPoint) > 12000.0f &&
                                                                                                       !(o.ClassType == VehicleClass.Helicopters || o.ClassType == VehicleClass.Military || o.ClassType == VehicleClass.Trains));

            if (currentJobVehicle != null)
            {
                currentJobVehicle.AttachBlip();
                currentJobVehicle.AttachedBlip.IsShortRange = true;
                Log.ToChat("[Tow]", "You have a new tow job", ConstantColours.TalkMarker);
            }
        }