Beispiel #1
0
        private async Task onStable()
        {
            if (StableNpc.Count() == 0)
            {
                return;
            }

            int     pid     = API.PlayerPedId();
            Vector3 pCoords = API.GetEntityCoords(pid, true, true);

            for (int i = 0; i < GetConfig.Config["Stables"].Count(); i++)
            {
                float x      = float.Parse(GetConfig.Config["Stables"][i]["EnterStable"][0].ToString());
                float y      = float.Parse(GetConfig.Config["Stables"][i]["EnterStable"][1].ToString());
                float z      = float.Parse(GetConfig.Config["Stables"][i]["EnterStable"][2].ToString());
                float radius = float.Parse(GetConfig.Config["Stables"][i]["EnterStable"][3].ToString());

                if (API.GetDistanceBetweenCoords(pCoords.X, pCoords.Y, pCoords.Z, x, y, z, false) <= radius && !MenuAPI.MenuController.IsAnyMenuOpen())
                {
                    await DrawTxt(GetConfig.Langs["PressToOpen"], 0.5f, 0.9f, 0.7f, 0.7f, 255, 255, 255, 255, true, true);

                    if (API.IsControlJustPressed(2, 0xD9D0E1C0))
                    {
                        StablesShop.stableId = i;
                        HorseManagment.DeleteDefaultHorse();
                        Menus.MainMenu.GetMenu().OpenMenu();
                        await Delay(1000);
                    }
                }
            }
        }
Beispiel #2
0
 public void setDefault(bool def)
 {
     if (!def)
     {
         this.isDefault = false;
     }
     else
     {
         for (int i = 0; i < HorseManagment.MyCarts.Count; i++)
         {
             if (HorseManagment.MyCarts[i].ID != this.ID)
             {
                 HorseManagment.MyCarts[i].setDefault(false);
             }
         }
         this.isDefault             = true;
         HorseManagment.spawnedCart = new Tuple <int, Cart>(0, this);
         HorseManagment.SetDefaultCartDB(this.ID);
     }
 }