public static void MoneyFlow(Client player) { if (!NAPI.Data.HasEntityData(player, "HAND_MONEY")) { NAPI.Chat.SendChatMessageToPlayer(player, "~g~[Сергей Мавроди] ~w~Чё ты тут забыл?"); return; } var all_money = 0; foreach (var item in nInventory.Items[Main.Players[player].UUID]) { if (item.Type != ItemType.BagWithMoney) { continue; } var money = Convert.ToInt32(item.Data); all_money += money; player.SetClothes(5, 0, 0); } nInventory.Remove(player, ItemType.BagWithMoney, 1); player.ResetData("HAND_MONEY"); Wallet.Change(player, (int)(all_money * 0.97)); GameLog.Money($"server", $"player({Main.Players[player].UUID})", (int)(all_money * 0.97), $"moneyFlow"); Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы отмыли {(int)(all_money * 0.97)}$. Мавроди забрал {(int)(all_money * 0.03)}$ за свои услуги", 3000); }
public static void RemoteEvent_carroomBuy(Client player, string vName, string color) { try { Business biz = BusinessManager.BizList[player.GetData("CARROOMID")]; NAPI.Entity.SetEntityPosition(player, new Vector3(biz.EnterPoint.X, biz.EnterPoint.Y, biz.EnterPoint.Z + 1.5)); player.FreezePosition = false; Main.Players[player].ExteriorPos = new Vector3(); Trigger.ClientEvent(player, "destroyCamera"); NAPI.Entity.SetEntityDimension(player, 0); Dimensions.DismissPrivateDimension(player); var house = Houses.HouseManager.GetHouse(player, true); if (house == null && Main.Players[player].HotelID == -1) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас нет личного дома", 3000); return; } if (house.GarageID == 0) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас нет гаража", 3000); return; } var garage = Houses.GarageManager.Garages[house.GarageID]; if (VehicleManager.getAllPlayerVehicles(player.Name).Count >= Houses.GarageManager.GarageTypes[garage.Type].MaxCars) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас максимальное кол-во машин", 3000); return; } var prod = biz.Products.FirstOrDefault(p => p.Name == vName); if (Main.Players[player].Money < prod.Price) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Недостаточно средств", 3000); return; } if (!BusinessManager.takeProd(biz.ID, 1, vName, prod.Price)) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Машин этой модели больше нет на складе", 3000); return; } MoneySystem.Wallet.Change(player, -prod.Price); GameLog.Money($"player({Main.Players[player].UUID})", $"biz({biz.ID})", prod.Price, $"buyCar({vName})"); var vNumber = VehicleManager.Create(player.Name, vName, carColors[color], carColors[color]); garage.SpawnCar(vNumber); Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"Вы купили {vName} с номером {vNumber}", 3000); Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"В скором времени она будет доставлена в Ваш гараж", 5000); } catch (Exception e) { Log.Write("CarroomBuy: " + e.Message, nLog.Type.Error); } }
public static void RentCar(Client player) { if (!player.IsInVehicle || !player.Vehicle.HasData("ACCESS") || player.Vehicle.GetData("ACCESS") != "RENT" || player.Vehicle.GetData("DRIVER") != null) { VehicleManager.WarpPlayerOutOfVehicle(player); return; } int price = CarInfos[player.Vehicle.GetData("NUMBER")].Price; switch (Main.Accounts[player].VipLvl) { case 0: price = CarInfos[player.Vehicle.GetData("NUMBER")].Price; break; case 1: price = Convert.ToInt32(CarInfos[player.Vehicle.GetData("NUMBER")].Price * 0.95); break; case 2: price = Convert.ToInt32(CarInfos[player.Vehicle.GetData("NUMBER")].Price * 0.9); break; case 3: price = Convert.ToInt32(CarInfos[player.Vehicle.GetData("NUMBER")].Price * 0.85); break; case 4: price = Convert.ToInt32(CarInfos[player.Vehicle.GetData("NUMBER")].Price * 0.8); break; default: price = CarInfos[player.Vehicle.GetData("NUMBER")].Price; break; } if (Main.Players[player].Money < price) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Недостаточно средств на аренду", 3000); VehicleManager.WarpPlayerOutOfVehicle(player); return; } player.Vehicle.SetData("DRIVER", player); player.SetData("RENTED_CAR", player.Vehicle); player.SetData("IN_RENT_CAR", true); MoneySystem.Wallet.Change(player, -price); GameLog.Money($"player({Main.Players[player].UUID})", $"server", price, $"rentCar"); }
public static void callback_moneyflow(Client player, int index) { try { switch (index) { case 0: MoneyFlow(player); return; case 1: if (player.HasData("HEIST_DRILL") || player.HasData("HAND_MONEY")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас уже есть дрель или деньги в руках", 3000); return; } if (!Wallet.Change(player, -20000)) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Недостаточно денег", 3000); return; } GameLog.Money($"player({Main.Players[player].UUID})", $"server", 20000, $"buyMavr(drill)"); player.SetClothes(5, 41, 0); nInventory.Add(player, new nItem(ItemType.BagWithDrill)); player.SetData("HEIST_DRILL", true); Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы купили сумку с дрелью для ограблений", 3000); return; case 2: if (Main.Players[player].Money < 200) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Недостаточно денег", 3000); return; } var tryAdd = nInventory.TryAdd(player, new nItem(ItemType.Lockpick)); if (tryAdd == -1 || tryAdd > 0) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Недостаточно места в инвентаре", 3000); return; } Wallet.Change(player, -200); GameLog.Money($"player({Main.Players[player].UUID})", $"server", 200, $"buyMavr(lockpick)"); nInventory.Add(player, new nItem(ItemType.Lockpick, 1)); Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы купили отмычку для замков", 3000); return; case 3: if (Main.Players[player].Money < 1200) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Недостаточно денег", 3000); return; } tryAdd = nInventory.TryAdd(player, new nItem(ItemType.ArmyLockpick)); if (tryAdd == -1 || tryAdd > 0) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Недостаточно места в инвентаре", 3000); return; } Wallet.Change(player, -1200); GameLog.Money($"player({Main.Players[player].UUID})", $"server", 1200, $"buyMavr(armylockpick)"); nInventory.Add(player, new nItem(ItemType.ArmyLockpick, 1)); Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы купили военную отмычку", 3000); return; case 4: if (Main.Players[player].Money < 600) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Недостаточно денег", 3000); return; } tryAdd = nInventory.TryAdd(player, new nItem(ItemType.Cuffs)); if (tryAdd == -1 || tryAdd > 0) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Недостаточно места в инвентаре", 3000); return; } Wallet.Change(player, -600); GameLog.Money($"player({Main.Players[player].UUID})", $"server", 600, $"buyMavr(cuffs)"); nInventory.Add(player, new nItem(ItemType.Cuffs, 1)); Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы купили стяжки для рук", 3000); return; case 5: if (Main.Players[player].Money < 600) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Недостаточно денег", 3000); return; } tryAdd = nInventory.TryAdd(player, new nItem(ItemType.Pocket)); if (tryAdd == -1 || tryAdd > 0) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Недостаточно места в инвентаре", 3000); return; } Wallet.Change(player, -600); GameLog.Money($"player({Main.Players[player].UUID})", $"server", 600, $"buyMavr(pocket)"); nInventory.Add(player, new nItem(ItemType.Pocket, 1)); Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы купили мешок на голову", 3000); return; case 6: if (Main.Players[player].WantedLVL == null) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не находитесь в розыске", 3000); return; } if (Main.Players[player].Money < 800) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Недостаточно средств", 3000); return; } Wallet.Change(player, -800); GameLog.Money($"player({Main.Players[player].UUID})", $"server", 800, $"buyMavr(wanted)"); Main.Players[player].WantedLVL.Level--; if (Main.Players[player].WantedLVL.Level == 0) { Main.Players[player].WantedLVL = null; } Police.setPlayerWantedLevel(player, Main.Players[player].WantedLVL); return; } } catch (Exception e) { Log.Write("mavrbuy: " + e.Message, nLog.Type.Error); } }
public static void startDrivingCourse(Client player, int index) { if (player.HasData("IS_DRIVING") || player.GetData("ON_WORK")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не можете сделать это сейчас", 3000); return; } if (Main.Players[player].Licenses[index]) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас уже есть эта лицензия", 3000); return; } switch (index) { case 0: if (Main.Players[player].Money < LicPrices[0]) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас недостаточно денег, чтобы купить эту лицензию", 3000); return; } var vehicle = NAPI.Vehicle.CreateVehicle(VehicleHash.Bagger, startCourseCoord[0], startCourseRot[0], 30, 30); player.SetIntoVehicle(vehicle, -1); player.SetData("SCHOOLVEH", vehicle); vehicle.SetData("ACCESS", "SCHOOL"); vehicle.SetData("DRIVER", player); player.SetData("IS_DRIVING", true); player.SetData("LICENSE", 0); Trigger.ClientEvent(player, "createCheckpoint", 12, 1, drivingCoords[0] - new Vector3(0, 0, 2), 4, 0, 255, 0, 0); Trigger.ClientEvent(player, "createWaypoint", drivingCoords[0].X, drivingCoords[0].Y); player.SetData("CHECK", 0); MoneySystem.Wallet.Change(player, -LicPrices[0]); Fractions.Stocks.fracStocks[6].Money += LicPrices[0]; GameLog.Money($"player({Main.Players[player].UUID})", $"frac(6)", LicPrices[0], $"buyLic"); Core.VehicleStreaming.SetEngineState(vehicle, false); Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"Чтобы завести транспорт, нажмите B", 3000); return; case 1: if (Main.Players[player].Money < LicPrices[1]) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас недостаточно денег, чтобы купить эту лицензию", 3000); return; } vehicle = NAPI.Vehicle.CreateVehicle(VehicleHash.Dilettante, startCourseCoord[0], startCourseRot[0], 30, 30); player.SetIntoVehicle(vehicle, -1); player.SetData("SCHOOLVEH", vehicle); vehicle.SetData("ACCESS", "SCHOOL"); vehicle.SetData("DRIVER", player); player.SetData("IS_DRIVING", true); player.SetData("LICENSE", 1); Trigger.ClientEvent(player, "createCheckpoint", 12, 1, drivingCoords[0] - new Vector3(0, 0, 2), 4, 0, 255, 0, 0); Trigger.ClientEvent(player, "createWaypoint", drivingCoords[0].X, drivingCoords[0].Y); player.SetData("CHECK", 0); MoneySystem.Wallet.Change(player, -LicPrices[1]); Fractions.Stocks.fracStocks[6].Money += LicPrices[1]; GameLog.Money($"player({Main.Players[player].UUID})", $"frac(6)", LicPrices[1], $"buyLic"); Core.VehicleStreaming.SetEngineState(vehicle, false); Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"Чтобы завести транспорт, нажмите B", 3000); return; case 2: if (Main.Players[player].Money < LicPrices[2]) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас недостаточно денег, чтобы купить эту лицензию", 3000); return; } vehicle = NAPI.Vehicle.CreateVehicle(VehicleHash.Flatbed, startCourseCoord[0], startCourseRot[0], 30, 30); player.SetIntoVehicle(vehicle, -1); player.SetData("SCHOOLVEH", vehicle); vehicle.SetData("ACCESS", "SCHOOL"); vehicle.SetData("DRIVER", player); player.SetData("IS_DRIVING", true); player.SetData("LICENSE", 2); Trigger.ClientEvent(player, "createCheckpoint", 12, 1, drivingCoords[0] - new Vector3(0, 0, 2), 4, 0, 255, 0, 0); Trigger.ClientEvent(player, "createWaypoint", drivingCoords[0].X, drivingCoords[0].Y); player.SetData("CHECK", 0); MoneySystem.Wallet.Change(player, -LicPrices[2]); Fractions.Stocks.fracStocks[6].Money += LicPrices[2]; GameLog.Money($"player({Main.Players[player].UUID})", $"frac(6)", LicPrices[2], $"buyLic"); Core.VehicleStreaming.SetEngineState(vehicle, false); Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"Чтобы завести транспорт, нажмите B", 3000); return; case 3: if (Main.Players[player].Money < LicPrices[3]) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас недостаточно денег, чтобы купить эту лицензию", 3000); return; } Main.Players[player].Licenses[3] = true; MoneySystem.Wallet.Change(player, -LicPrices[3]); Fractions.Stocks.fracStocks[6].Money += LicPrices[3]; GameLog.Money($"player({Main.Players[player].UUID})", $"frac(6)", LicPrices[3], $"buyLic"); Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы успешно купили лицензию на водный транспорт", 3000); Dashboard.sendStats(player); return; case 4: if (Main.Players[player].Money < LicPrices[4]) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"", 3000); Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас недостаточно денег, чтобы купить эту лицензию", 3000); return; } Main.Players[player].Licenses[4] = true; MoneySystem.Wallet.Change(player, -LicPrices[4]); Fractions.Stocks.fracStocks[6].Money += LicPrices[4]; GameLog.Money($"player({Main.Players[player].UUID})", $"frac(6)", LicPrices[4], $"buyLic"); Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы успешно купили лицензию управление вертолётами", 3000); Dashboard.sendStats(player); return; case 5: if (Main.Players[player].Money < LicPrices[5]) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас недостаточно денег, чтобы купить эту лицензию", 3000); return; } Main.Players[player].Licenses[5] = true; MoneySystem.Wallet.Change(player, -LicPrices[5]); Fractions.Stocks.fracStocks[6].Money += LicPrices[5]; GameLog.Money($"player({Main.Players[player].UUID})", $"frac(6)", LicPrices[5], $"buyLic"); Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы успешно купили лицензию управление самолётами", 3000); Dashboard.sendStats(player); return; } }