Log in to reply
 

Script Limit speed not work



  • This is my code use to limit current vehicle speed but it does not work.
    when I press "Get speed" in menu, the speed set to _listOfSpeed [listIndex] but still increase

        void chooseSpeedLimited()
        {
            UIMenu submenu = modMenuPool.AddSubMenu(mainMenu, "Choose Speed Limit");
            List<dynamic> _listOfSpeed = new List<dynamic>();
            dynamic[] speed = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250 };
            _listOfSpeed.AddRange(speed);
            UIMenuListItem _list = new UIMenuListItem("Speed: ", _listOfSpeed, 0);
            submenu.AddItem(_list);
            UIMenuItem getSpeed = new UIMenuItem("Get Speed");
            submenu.AddItem(getSpeed);
           Vehicle vehicle = Game.Player.Character.CurrentVehicle;
            submenu.OnItemSelect += (sender, item, index) =>
            {
                if(item==getSpeed)
                {
                    
                    int listIndex = _list.Index;
                    
                    vehicle.Speed = _listOfSpeed[listIndex];
    
                    UI.ShowSubtitle("You have set limit your car");
                }
            };
    
        }

Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.