[text] 1111

Viewer

  1. [RemoteEvent("carroomBuy")]
  2.         public static void RemoteEvent_carroomBuy(Player player, string vName, string color)
  3.         {
  4.             try
  5.             {
  6.                 Business biz = BusinessManager.BizList[player.GetData<int>("CARROOMID")];
  7.                 NAPI.Entity.SetEntityPosition(player, new Vector3(biz.EnterPoint.X, biz.EnterPoint.Y, biz.EnterPoint.Z + 1.5));
  8.                 Trigger.ClientEvent(player, "freeze", false);
  9.  
  10.                 Main.Players[player].ExteriorPos = new Vector3();
  11.                 Trigger.ClientEvent(player, "destroyCamera");
  12.                 NAPI.Entity.SetEntityDimension(player, 0);
  13.                 Dimensions.DismissPrivateDimension(player);
  14.                 var house = Houses.HouseManager.GetHouse(player, true);
  15.                 if (house == null || house.GarageID == 0)
  16.                 {
  17.                     // Player without garage
  18.                     if (VehicleManager.getAllPlayerVehicles(player.Name).Count >= 1)
  19.                     {
  20.                         Notify.Send(player, NotifyType.Error, NotifyPosition.BottomLeft, $"Нельзя иметь больше 1 машины без дома", 3000);
  21.                         return;
  22.                     }
  23.                     string vNumber = BuyVehicle(player, biz, vName, color);
  24.                     if (vNumber != "none")
  25.                     {
  26.                         VehicleManager.Spawn(vNumber, biz.UnloadPoint, 90, player);
  27.                     }
  28.                 }
  29.                 else
  30.                 {
  31.                     var garage = Houses.GarageManager.Garages[house.GarageID];
  32.                     // Проверка свободного места в гараже
  33.                     if (VehicleManager.getAllPlayerVehicles(player.Name).Count >= Houses.GarageManager.GarageTypes[garage.Type].MaxCars)
  34.                     {
  35.                         Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Ваши гаражи полны", 3000);
  36.                         return;
  37.                     }
  38.                     string vNumber = BuyVehicle(player, biz, vName, color);
  39.                     if (vNumber != "none")
  40.                     {
  41.                         garage.SpawnCar(vNumber);
  42.                     }
  43.                 }
  44.             }
  45.             catch (Exception e) { Log.Write("CarroomBuy: " + e.Message, nLog.Type.Error); }
  46.         }

Editor

You can edit this paste and save as new:


File Description
  • 1111
  • Paste Code
  • 28 Mar-2022
  • 2.36 Kb
You can Share it: