public static void dropMoneyBag(Client player) { if (Main.Players[player].InsideHouseID != -1 || Main.Players[player].InsideGarageID != -1) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не можете сделать это, находясь в доме/гараже", 3000); return; } var pos = NAPI.Entity.GetEntityPosition(player); var money = -1; foreach (var item in nInventory.Items[Main.Players[player].UUID]) { if (item.Type != ItemType.BagWithMoney) { continue; } money = Convert.ToInt32(item.Data); nInventory.Remove(player, item); break; } if (money == -1) { return; } player.SetClothes(5, 0, 0); var money_bag = NAPI.Object.CreateObject(-711724000, player.Position + new Vector3(0, 0, -1.15), player.Rotation + new Vector3(90, 0, 0), 255, 0); money_bag.SetSharedData("TYPE", "MoneyBag"); money_bag.SetSharedData("PICKEDT", false); NAPI.Data.SetEntityData(money_bag, "MONEY_IN_BAG", money); player.ResetData("HAND_MONEY"); GameLog.Items($"player({Main.Players[player].UUID})", "ground", Convert.ToInt32(ItemType.BagWithMoney), 1, $"{money}"); }
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; } }
private static void AddAnswer(Client player, int repID, string response) { try { response = Main.BlockSymbols(response); if (!Main.Players.ContainsKey(player)) { return; } if (Main.Players[player].AdminLVL < adminLvL) { return; } if (!Reports.ContainsKey(repID)) { return; } DateTime now = DateTime.Now; try { Client target = NAPI.Player.GetPlayerFromName(Reports[repID].Author); if (target is null) { Notify.Send(player, NotifyType.Warning, NotifyPosition.BottomCenter, "Игрок не найден!", 3000); } else { target.SendChatMessage($"~r~Ответ от {player.Name} ({player.Value}): {response}"); Notify.Send(target, NotifyType.Info, NotifyPosition.BottomCenter, $"Ответ от {player.Name}: {response}", 5000); foreach (var p in Main.Players.Keys.ToList()) { if (Main.Players[p].AdminLVL >= adminLvL) { p.SendChatMessage($"~y~[ANSWER] {player.Name}({player.Value})->{target.Name}({target.Value}): {response}"); } } GameLog.Admin(player.Name, $"answer({response})", target.Name); } } catch (Exception ex) { Log.Write($"PlayerAnswer:\n" + ex.ToString(), nLog.Type.Error); } MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = "UPDATE questions SET Respondent=@resp,Response=@res,Status=@st,Closed=@time WHERE ID=@repid LIMIT 1"; cmd.Parameters.AddWithValue("@resp", player.Name); cmd.Parameters.AddWithValue("@res", response); cmd.Parameters.AddWithValue("@st", true); cmd.Parameters.AddWithValue("@time", MySQL.ConvertTime(now)); cmd.Parameters.AddWithValue("@repid", repID); MySQL.Query(cmd); Reports[repID].Author = player.Name; Reports[repID].Response = response; Reports[repID].ClosedDate = now; Reports[repID].Status = true; Remove(repID); } catch (Exception e) { Log.Write(e.ToString(), nLog.Type.Error); } }