Exemplo n.º 1
0
 public VehicleSpawnAction(uint vehicleHash)
 {
     CloseAllMenuAfterAction = true;
     Action = () =>
     {
         DotNetTrainerScript.SpawnCar(vehicleHash, true);
     };
 }
Exemplo n.º 2
0
 public VehicleSpawnAction(string vehicleName)
 {
     CloseAllMenuAfterAction = true;
     Action = () =>
     {
         DotNetTrainerScript.SpawnCar(vehicleName, true);
     };
 }
        void InitMenu()
        {
            #region player

            var place = new Menu()
            {
                DrawType = DrawTypeEnum.NormalMenu,
            };
            place.Items.Add(
                new MenuItem()
            {
                Title   = "Marker",
                PointTo = new PointAction()
                {
                    Action = () => { TeleportToMarker(); }
                }
            }
                );
            place.Items.Add(new TeleportMenuItem("MICHAEL'S HOUSE", -852.4f, 160.0f, 65.6f));
            place.Items.Add(new TeleportMenuItem("FRANKLIN'S HOUSE", 7.9f, 548.1f, 175.5f));
            place.Items.Add(new TeleportMenuItem("TREVOR'S TRAILER", 1985.7f, 3812.2f, 32.2f));
            place.Items.Add(new TeleportMenuItem("STRIPCLUB", 127.4f, -1307.7f, 29.2f));
            place.Items.Add(new TeleportMenuItem("FERRIS WHEEL", -1670.7f, -1125.0f, 13.0f));
            place.Items.Add(new TeleportMenuItem("MILITARY BASE", -2047.4f, 3132.1f, 32.8f));
            place.Items.Add(new TeleportMenuItem("CHILLIAD", 425.4f, 5614.3f, 766.5f));
            place.Items.Add(new TeleportMenuItem("警察局", 807.2786f, -1277.551f, 25.96281f));

            var teleport = new MenuItem()
            {
                Title   = "TELEPORT",
                PointTo = place
            };

            place.FromItem = teleport;

            var player = new Menu()
            {
                DrawType = DrawTypeEnum.NormalMenu,
                Identity = "player",
                Items    = new MenuItem[]
                {
                    teleport,
                    new MenuItem()
                    {
                        Title   = "WANTED UP",
                        PointTo = new PointAction()
                        {
                            Action = () => { Game.Player.WantedLevel++; }
                        }
                    },
                    new MenuItem()
                    {
                        Title   = "WANTED DOWN",
                        PointTo = new PointAction()
                        {
                            Action = () => { Game.Player.WantedLevel--; }
                        }
                    },
                    new MenuItem()
                    {
                        GetTitle = () => { return("INVINCIBLE  [" + (userInvincible?"ON":"OFF") + "]"); },
                        PointTo  = new PointAction()
                        {
                            Action = () =>
                            {
                                userInvincible = !userInvincible;
                            }
                        }
                    },
                    new MenuItem()
                    {
                        Title   = "GET PLAYER POSITION",
                        PointTo = new PointAction()
                        {
                            Action = () =>
                            {
                                var p = Game.Player.Character.Position;
                                ShowStatusText(p.ToString());
                                logger.Log(p.X + "f," + p.Y + "f," + p.Z + "f");
                            }
                        }
                    }
                }.ToList()
            };

            #endregion

            #region vehicle

            var fixVehicle = new PointAction()
            {
                Action = () =>
                {
                    if (Function.Call <bool>(Hash.IS_PED_IN_ANY_VEHICLE, Game.Player.Character.Handle, 0))
                    {
                        Function.Call(Hash.SET_VEHICLE_FIXED, Function.Call <int>(Hash.GET_VEHICLE_PED_IS_USING, Game.Player.Character.Handle));
                    }
                    else
                    {
                        ShowStatusText("player isn't in a vehicle");
                    }
                }
            };

            var spawner = new Menu()
            {
                DrawType = DrawTypeEnum.ScreenList,
                Identity = "vehicle_spawner",
            };

            //至尊慧眼,COGCABRI,57346
            //愛國者,PATRIOT,-808457413
            //愛快,ALPHA,57346
            //公路霸者,DOMINATO,80636076
            //貨機,CARGOPL,368211810
            //碼頭裝卸車,HANDLER,82434
            //FIB 公務車, FBI,154882
            //泰坦號,TITAN,73218

            spawner.Items.Add(new SpawnCarMenuItem("BANSHEE", "女妖"));
            spawner.Items.Add(new SpawnCarMenuItem("INSURGENT2", "叛亂份子"));
            spawner.Items.Add(new SpawnCarMenuItem("RHINO", "犀式坦克"));
            spawner.Items.Add(new SpawnCarMenuItem("BLAZER3", "四輪摩托"));
            spawner.Items.Add(new SpawnCarMenuItem("STRETCH", "加長轎車"));
            spawner.Items.Add(new SpawnCarMenuItem("HUNTLEY", "肯特利S"));
            spawner.Items.Add(new SpawnCarMenuItem("FQ2"));
            spawner.Items.Add(new SpawnCarMenuItem("TAXI"));
            spawner.Items.Add(new SpawnCarMenuItem("POLICE2"));
            spawner.Items.Add(new SpawnCarMenuItem("FBI2"));

            spawner.Items.Add(new SpawnCarMenuItem("ISSI2", "天威"));
            spawner.Items.Add(new SpawnCarMenuItem("PANTO", "微型汽車"));
            spawner.Items.Add(new SpawnCarMenuItem("SUPERD"));
            spawner.Items.Add(new SpawnCarMenuItem("POLICEB", "警用摩托"));
            spawner.Items.Add(new SpawnCarMenuItem("DOUBLE", "摩托"));
            spawner.Items.Add(new SpawnCarMenuItem("DUBSTA3", "迪布達6x6"));
            spawner.Items.Add(new SpawnCarMenuItem("MONSTER", "大腳車"));
            spawner.Items.Add(new SpawnCarMenuItem("AIRTUG", "行李拖車"));
            spawner.Items.Add(new SpawnCarMenuItem("RIPLEY", "機場牽引車"));
            spawner.Items.Add(new SpawnCarMenuItem(VehicleHash.UtilityTruck, "公共事業卡車"));

            spawner.Items.Add(new SpawnCarMenuItem("BULLDOZER", "推土機"));
            spawner.Items.Add(new SpawnCarMenuItem("CUTTER", "鑽洞機"));
            spawner.Items.Add(new SpawnCarMenuItem("BUS"));
            spawner.Items.Add(new SpawnCarMenuItem("COACH"));
            spawner.Items.Add(new SpawnCarMenuItem("AMBULANCE"));
            spawner.Items.Add(new SpawnCarMenuItem(VehicleHash.FireTruck, "消防車"));
            spawner.Items.Add(new SpawnCarMenuItem("BARRACKS", "軍用卡車"));
            spawner.Items.Add(new SpawnCarMenuItem("DUMP", "運土車"));
            spawner.Items.Add(new SpawnCarMenuItem("HAULER", "卡車頭"));
            spawner.Items.Add(new SpawnCarMenuItem("TOWTRUCK", "拖吊車"));

            spawner.Items.Add(new SpawnCarMenuItem("BUZZARD", "小直升機"));
            spawner.Items.Add(new SpawnCarMenuItem("SAVAGE", "大直升機"));
            spawner.Items.Add(new SpawnCarMenuItem("CARGOBOB3", "運輸直升機"));
            spawner.Items.Add(new SpawnCarMenuItem("JET", "大客機"));
            spawner.Items.Add(new SpawnCarMenuItem("LUXOR", "商務機"));
            spawner.Items.Add(new SpawnCarMenuItem("LAZER", "戰鬥機"));
            spawner.Items.Add(new SpawnCarMenuItem("HYDRA", "鷂式戰機"));
            spawner.Items.Add(new SpawnCarMenuItem("DODO", "水上飛機"));
            spawner.Items.Add(new SpawnCarMenuItem("STUNT", "特技飛機"));
            spawner.Items.Add(new SpawnCarMenuItem(VehicleHash.CargoPlane, "運輸機"));
            spawner.Items.Add(new SpawnCarMenuItem("spirit", "轟炸機"));
            spawner.Items.Add(new SpawnCarMenuItem("j15a", "殲15"));

            spawner.Items.Add(new SpawnCarMenuItem("BLIMP", "汽艇"));
            spawner.Items.Add(new SpawnCarMenuItem("SCORCHER", "自行車"));
            spawner.Items.Add(new SpawnCarMenuItem("TRACTOR2", "農耕機"));
            spawner.Items.Add(new SpawnCarMenuItem("DINGHY2", "救生艇"));
            spawner.Items.Add(new SpawnCarMenuItem("SEASHARK2", "小海鯊"));
            spawner.Items.Add(new SpawnCarMenuItem("SUBMERSIBLE", "潛艇"));
            spawner.Items.Add(new SpawnCarMenuItem("satoca", "SATOCA"));

            var spawnerEntry = new MenuItem()
            {
                Identity = "main_vehicle_spawner", Title = "CAR SPAWNER", PointTo = spawner
            };
            spawner.FromItem = spawnerEntry;

            var vehicle = new Menu()
            {
                DrawType = DrawTypeEnum.NormalMenu,
                Identity = "vehicle",
                Items    = new MenuItem[]
                {
                    spawnerEntry,
                    new MenuItem()
                    {
                        Identity = "main_vehicle_fix", Title = "FIX", PointTo = fixVehicle
                    },
                    new MenuItem()
                    {
                        GetTitle = () => { return("INVINCIBLE  [" + (carInvincible?"ON":"OFF") + "]"); },
                        PointTo  = new PointAction()
                        {
                            Action = () =>
                            {
                                //todo 设置正在坐的车
                                carInvincible = !carInvincible;
                            }
                        }
                    },
                    new MenuItem()
                    {
                        GetTitle = () => { return("WRAP IN SPAWNED  [" + (wrapInSpawned?"ON":"OFF") + "]"); },
                        PointTo  = new PointAction()
                        {
                            Action = () => { wrapInSpawned = !wrapInSpawned; }
                        }
                    },
                    //new MenuItem()
                    //{
                    //    GetTitle = ()=>{ return "SEATBELT  ["+ (seatbelt?"ON":"OFF") +"]";},
                    //    PointTo = new PointAction()
                    //    {
                    //        Action = () => { seatbelt = !seatbelt; }
                    //    }
                    //},
                }.ToList()
            };
            #endregion

            #region weapon


            var weapon = new Menu()
            {
                DrawType = DrawTypeEnum.NormalMenu,
                Identity = "weapon",
                Items    = new MenuItem[]
                {
                    new MenuItem()
                    {
                        Title   = "GET ALL WEAPON",
                        PointTo = new PointAction()
                        {
                            Action = () =>
                            {
                                foreach (uint v in Enum.GetValues(typeof(WeaponHash)))
                                {
                                    Game.Player.Character.Weapons.Give((WeaponHash)v, 1000, false, true);
                                }
                            }
                        }
                    },
                    new MenuItem()
                    {
                        Title   = "REMOVE ALL WEAPON",
                        PointTo = new PointAction()
                        {
                            Action = () =>
                            {
                                Game.Player.Character.Weapons.RemoveAll();
                            }
                        }
                    },
                    new MenuItem()
                    {
                        GetTitle = () => { return("NO RELOAD  [" + (weaponNoReload?"ON":"OFF") + "]"); },
                        PointTo  = new PointAction()
                        {
                            Action = () =>
                            {
                                weaponNoReload = !weaponNoReload;
                            }
                        }
                    },
                }.ToList()
            };

            #endregion

            #region time

            var timeForward = new PointAction()
            {
                Identity = "time_forward",
                Action   = () =>
                {
                    int h = Function.Call <int>(Hash.GET_CLOCK_HOURS);
                    h = (h == 23) ? 0 : h + 1;
                    int m = Function.Call <int>(Hash.GET_CLOCK_MINUTES);
                    Function.Call <int>(Hash.SET_CLOCK_TIME, h, m, 0);
                    ShowStatusText(h + ":" + m);
                }
            };

            var timeBackward = new PointAction()
            {
                Identity = "time_backward",
                Action   = () =>
                {
                    int h = Function.Call <int>(Hash.GET_CLOCK_HOURS);
                    h = (h == 0) ? 23 : h - 1;
                    int m = Function.Call <int>(Hash.GET_CLOCK_MINUTES);
                    Function.Call <int>(Hash.SET_CLOCK_TIME, h, m, 0);
                    ShowStatusText(h + ":" + m);
                }
            };

            var time = new Menu()
            {
                DrawType = DrawTypeEnum.NormalMenu,
                Identity = "time",
                Items    = new MenuItem[]
                {
                    new MenuItem()
                    {
                        Identity = "main_time_forward", Title = "FORWARD", PointTo = timeForward
                    },
                    new MenuItem()
                    {
                        Identity = "main_time_backward", Title = "BACKWARD", PointTo = timeBackward
                    },
                }.ToList()
            };
            #endregion

            #region main

            var main_player = new MenuItem()
            {
                Identity = "main_player", Title = "PLAYER", PointTo = player
            };
            var main_vehicle = new MenuItem()
            {
                Identity = "main_vehicle", Title = "VEHICLE", PointTo = vehicle
            };
            var main_weapon = new MenuItem()
            {
                Identity = "main_weapon", Title = "WEAPON", PointTo = weapon
            };
            var main_time = new MenuItem()
            {
                Identity = "main_time", Title = "TIME", PointTo = time
            };

            var nearby = new MenuItem()
            {
                Title   = "SHOW NEARBY CARS",
                PointTo = new PointAction()
                {
                    Action = () =>
                    {
                        var cars = World.GetNearbyVehicles(Game.Player.Character.Position, 50)
                                   .Select(i => new VehicleInformation()
                        {
                            DisplayName = i.DisplayName, FriendlyName = i.FriendlyName, Hash = i.Model.Hash
                        })
                                   .Distinct(new VehicleInformationEqualityComparer());

                        nearbyCars.Items = cars.Select(i => new MenuItem()
                        {
                            Title = i.FriendlyName, PointTo = new PointAction()
                            {
                                Action = () => { LogCarInfo(i.DisplayName, i.FriendlyName, i.Hash); DotNetTrainerScript.SpawnCar((uint)i.Hash); }
                            }
                        }).ToList();
                        nearbyCars.Items.First().Selected = true;
                        currentMenu = nearbyCars;
                    }
                }
            };

            var main = new Menu()
            {
                DrawType = DrawTypeEnum.NormalMenu,
                Identity = "main",
                Items    = new MenuItem[]
                {
                    main_player,
                    main_vehicle,
                    main_weapon,
                    main_time,
                    nearby,
                }.ToList()
            };
            #endregion

            vehicle.FromItem = main_vehicle;
            player.FromItem  = main_player;
            time.FromItem    = main_time;
            weapon.FromItem  = main_weapon;

            AddMenu(main);
        }