public static void Event_PlayerDeath(Client player, Client entityKiller, uint weapon) { try { if (!Main.Players.ContainsKey(player)) { return; } if (Main.Players[player].WorkID == 2 && NAPI.Data.GetEntityData(player, "ON_WORK")) { NAPI.Data.SetEntityData(player, "ON_WORK", false); Customization.ApplyCharacter(player); } } catch (Exception e) { Log.Write("PlayerDeath: " + e.Message, nLog.Type.Error); } }
public static void StartWorkDay(Client player) { if (Main.Players[player].WorkID != 1) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Вы не работаете электриком. Устроиться можно в мэрии", 3000); return; } if (player.GetData("ON_WORK")) { Customization.ApplyCharacter(player); player.SetData("ON_WORK", false); Trigger.ClientEvent(player, "deleteCheckpoint", 15); Trigger.ClientEvent(player, "deleteWorkBlip"); Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"Вы закончили рабочий день", 3000); //player.SetData("PAYMENT", 0); return; } else { Customization.ClearClothes(player, Main.Players[player].Gender); if (Main.Players[player].Gender) { player.SetAccessories(1, 24, 2); player.SetClothes(3, 16, 0); player.SetClothes(11, 153, 10); player.SetClothes(4, 0, 5); player.SetClothes(6, 24, 0); } else { player.SetAccessories(1, 26, 2); player.SetClothes(3, 17, 0); player.SetClothes(11, 150, 1); player.SetClothes(4, 1, 5); player.SetClothes(6, 52, 0); } var check = WorkManager.rnd.Next(0, Checkpoints.Count - 1); player.SetData("WORKCHECK", check); Trigger.ClientEvent(player, "createCheckpoint", 15, 1, Checkpoints[check].Position, 1, 0, 255, 0, 0); Trigger.ClientEvent(player, "createWorkBlip", Checkpoints[check].Position); player.SetData("ON_WORK", true); Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, "Вы начали рабочий день", 3000); return; } }
private void timer_playerExitWorkVehicle(Client player, Vehicle vehicle) { NAPI.Task.Run(() => { try { if (!player.HasData("WORK_CAR_EXIT_TIMER")) { return; } if (NAPI.Data.GetEntityData(player, "IN_WORK_CAR")) { // Main.StopT(NAPI.Data.GetEntityData(player, "WORK_CAR_EXIT_TIMER"), "timer_16"); Timers.Stop(NAPI.Data.GetEntityData(player, "WORK_CAR_EXIT_TIMER")); NAPI.Data.ResetEntityData(player, "WORK_CAR_EXIT_TIMER"); Log.Debug("Player exit work vehicle timer was stoped"); return; } if (NAPI.Data.GetEntityData(player, "CAR_EXIT_TIMER_COUNT") > 180) { respawnCar(vehicle); Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"Вы закончили рабочий день", 3000); NAPI.Data.SetEntityData(player, "PAYMENT", 0); NAPI.Data.SetEntityData(player, "ON_WORK", false); NAPI.Data.SetEntityData(player, "WORK", null); NAPI.ClientEvent.TriggerClientEvent(player, "deleteCheckpoint", 16, 0); NAPI.ClientEvent.TriggerClientEvent(player, "deleteWorkBlip"); //Main.StopT(NAPI.Data.GetEntityData(player, "WORK_CAR_EXIT_TIMER"), "timer_17"); Timers.Stop(NAPI.Data.GetEntityData(player, "WORK_CAR_EXIT_TIMER")); NAPI.Data.ResetEntityData(player, "WORK_CAR_EXIT_TIMER"); Customization.ApplyCharacter(player); if (player.HasData("WORKOBJECT")) { BasicSync.DetachObject(player); player.ResetData("WORKOBJECT"); } return; } NAPI.Data.SetEntityData(player, "CAR_EXIT_TIMER_COUNT", NAPI.Data.GetEntityData(player, "CAR_EXIT_TIMER_COUNT") + 1); } catch (Exception e) { Log.Write("Timer_PlayerExitWorkVehicle_Collector:\n" + e.ToString(), nLog.Type.Error); } }); }
private static void callback_armyclothes(Client client, Menu menu, Menu.Item item, string eventName, dynamic data) { switch (item.ID) { case "change": if (Main.Players[client].FractionLVL < 6) { Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не можете переодеться/раздеться", 3000); return; } if (!client.GetData("ON_DUTY")) { Notify.Send(client, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы переоделись в служебную форму", 3000); Manager.setSkin(client, 14, Main.Players[client].FractionLVL); client.SetData("ON_DUTY", true); } else { Notify.Send(client, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы переоделись в повседневную одежду", 3000); Customization.ApplyCharacter(client); if (client.HasData("HAND_MONEY")) { client.SetClothes(5, 45, 0); } else if (client.HasData("HEIST_DRILL")) { client.SetClothes(5, 41, 0); } client.SetData("ON_DUTY", false); } return; case "combat": MenuManager.Close(client); OpenArmyCombatMenu(client); return; case "close": MenuManager.Close(client); return; } }
public static void Event_PlayerDeath(Client player, Client entityKiller, uint weapon) { try { if (!Main.Players.ContainsKey(player)) { return; } if (Main.Players[player].WorkID == 7 && player.GetData("ON_WORK")) { var vehicle = player.GetData("WORK"); respawnCar(vehicle); Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"Вы закончили рабочий день", 3000); NAPI.Data.SetEntityData(player, "PAYMENT", 0); NAPI.Data.SetEntityData(player, "ON_WORK", false); NAPI.Data.SetEntityData(player, "WORK", null); Trigger.ClientEvent(player, "deleteCheckpoint", 16, 0); Trigger.ClientEvent(player, "deleteWorkBlip"); Customization.ApplyCharacter(player); if (player.HasData("WORK_CAR_EXIT_TIMER")) { //Main.StopT(NAPI.Data.GetEntityData(player, "WORK_CAR_EXIT_TIMER"), "timer_14"); Timers.Stop(NAPI.Data.GetEntityData(player, "WORK_CAR_EXIT_TIMER")); NAPI.Data.ResetEntityData(player, "WORK_CAR_EXIT_TIMER"); } } if (player.HasData("WORKOBJECT")) { BasicSync.DetachObject(player); player.ResetData("WORKOBJECT"); } } catch (Exception e) { Log.Write("PlayerDeath: " + e.Message, nLog.Type.Error); } }
public static void beginWorkDay(Client player) { if (Main.Players[player].FractionID == 6) { if (!NAPI.Data.GetEntityData(player, "ON_DUTY")) { Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы начали рабочий день", 3000); Manager.setSkin(player, 6, Main.Players[player].FractionLVL); NAPI.Data.SetEntityData(player, "ON_DUTY", true); if (Main.Players[player].FractionLVL >= 3) { player.Armor = 100; } return; } else { Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы закончили рабочий день", 3000); Customization.ApplyCharacter(player); if (player.HasData("HAND_MONEY")) { player.SetClothes(5, 45, 0); } else if (player.HasData("HEIST_DRILL")) { player.SetClothes(5, 41, 0); } NAPI.Data.SetEntityData(player, "ON_DUTY", false); return; } } else { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник мэрии", 3000); } }
private void timer_playerExitWorkVehicle(Client player, Vehicle vehicle) { NAPI.Task.Run(() => { try { if (!player.HasData("WORK_CAR_EXIT_TIMER")) { return; } if (NAPI.Data.GetEntityData(player, "IN_WORK_CAR")) { //Main.StopT(NAPI.Data.GetEntityData(player, "WORK_CAR_EXIT_TIMER"), "timer_5"); Timers.Stop(NAPI.Data.GetEntityData(player, "WORK_CAR_EXIT_TIMER")); NAPI.Data.ResetEntityData(player, "WORK_CAR_EXIT_TIMER"); Log.Debug("Player exit work vehicle timer was stoped"); return; } if (NAPI.Data.GetEntityData(player, "CAR_EXIT_TIMER_COUNT") > 60) { respawnCar(vehicle); NAPI.Data.SetEntityData(player, "ON_WORK", false); NAPI.Data.SetEntityData(player, "WORK", null); Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"Вы закончили рабочий день", 3000); Trigger.ClientEvent(player, "deleteCheckpoint", 4, 0); //Main.StopT(NAPI.Data.GetEntityData(player, "WORK_CAR_EXIT_TIMER"), "timer_6"); Timers.Stop(NAPI.Data.GetEntityData(player, "WORK_CAR_EXIT_TIMER")); NAPI.Data.ResetEntityData(player, "WORK_CAR_EXIT_TIMER"); Customization.ApplyCharacter(player); return; } NAPI.Data.SetEntityData(player, "CAR_EXIT_TIMER_COUNT", NAPI.Data.GetEntityData(player, "CAR_EXIT_TIMER_COUNT") + 1); } catch (Exception e) { Log.Write("Timer_PlayerExitWorkVehicle_Lawnmower: " + e.Message, nLog.Type.Error); } }); }
public static void interactPressed(Client player, int interact) { switch (interact) { case 15: if (player.IsInVehicle) { return; } if (player.HasData("FOLLOWING")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000); return; } player.SetData("IN_HOSPITAL", true); NAPI.Entity.SetEntityPosition(player, emsCheckpoints[1] + new Vector3(0, 0, 1.12)); Main.PlayerEnterInterior(player, emsCheckpoints[1] + new Vector3(0, 0, 1.12)); return; case 16: if (player.HasData("FOLLOWING")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000); return; } if (NAPI.Player.GetPlayerHealth(player) < 100) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны сначала закончить лечение", 3000); break; } /*if (player.HasData("HEAL_TIMER")) * { * Main.StopT(player.GetData("HEAL_TIMER")); * player.ResetData("HEAL_TIMER"); * Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Ваше лечение закончено", 3000); * }*/ player.SetData("IN_HOSPITAL", false); NAPI.Entity.SetEntityPosition(player, emsCheckpoints[0] + new Vector3(0, 0, 1.12)); Main.PlayerEnterInterior(player, emsCheckpoints[0] + new Vector3(0, 0, 1.12)); return; case 17: if (Main.Players[player].FractionID != 8) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник EMS", 3000); return; } if (!player.GetData("ON_DUTY")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не начали рабочий день", 3000); return; } if (!Stocks.fracStocks[8].IsOpen) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Склад закрыт", 3000); return; } OpenHospitalStockMenu(player); return; case 18: if (Main.Players[player].FractionID == 8) { if (!NAPI.Data.GetEntityData(player, "ON_DUTY")) { Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы начали рабочий день", 3000); Manager.setSkin(player, 8, Main.Players[player].FractionLVL); NAPI.Data.SetEntityData(player, "ON_DUTY", true); break; } else { Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы закончили рабочий день", 3000); Customization.ApplyCharacter(player); if (player.HasData("HAND_MONEY")) { player.SetClothes(5, 45, 0); } else if (player.HasData("HEIST_DRILL")) { player.SetClothes(5, 41, 0); } NAPI.Data.SetEntityData(player, "ON_DUTY", false); break; } } else { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник EMS", 3000); } return; case 19: if (NAPI.Player.GetPlayerHealth(player) > 99) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не нуждаетесь в лечении", 3000); break; } if (player.HasData("HEAL_TIMER")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы уже лечитесь", 3000); break; } Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы начали лечение", 3000); //player.SetData("HEAL_TIMER", Main.StartT(3750, 3750, (o) => healTimer(player), "HEAL_TIMER")); player.SetData("HEAL_TIMER", Timers.Start(3750, () => healTimer(player))); return; case 51: OpenTattooDeleteMenu(player); return; case 58: if (Main.Players[player].FractionID != 8) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник EMS", 3000); break; } if (!player.IsInVehicle || !player.Vehicle.HasData("CANMEDKITS")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не в машине или Ваша машина не может перевозить аптечки", 3000); break; } var medCount = VehicleInventory.GetCountOfType(player.Vehicle, ItemType.HealthKit); if (medCount >= 50) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"В машине максимум аптечек", 3000); break; } if (HumanMedkitsLefts <= 0) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Аптечки закончились. Приезжайте за новыми через час", 3000); break; } var toAdd = (HumanMedkitsLefts > 50 - medCount) ? 50 - medCount : HumanMedkitsLefts; HumanMedkitsLefts = toAdd; VehicleInventory.Add(player.Vehicle, new nItem(ItemType.HealthKit, toAdd)); Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы заполнили машину аптечками", 3000); return; case 63: if (Main.Players[player].FractionID != 8) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник EMS", 3000); break; } if (player.IsInVehicle) { return; } if (player.Position.Z > 50) { if (player.HasData("FOLLOWING")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000); return; } player.SetData("IN_HOSPITAL", true); NAPI.Entity.SetEntityPosition(player, emsCheckpoints[8] + new Vector3(0, 0, 1.12)); Main.PlayerEnterInterior(player, emsCheckpoints[8] + new Vector3(0, 0, 1.12)); } else { if (player.HasData("FOLLOWING")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000); return; } player.SetData("IN_HOSPITAL", false); NAPI.Entity.SetEntityPosition(player, emsCheckpoints[7] + new Vector3(0, 0, 1.12)); Main.PlayerEnterInterior(player, emsCheckpoints[7] + new Vector3(0, 0, 1.12)); } return; } }
public void onPlayerDeathHandler(Client player, Client entityKiller, uint weapon) { try { if (!Main.Players.ContainsKey(player)) { return; } Log.Debug($"{player.Name} is died by {weapon}"); FractionCommands.onPlayerDeathHandler(player, entityKiller, weapon); SafeMain.onPlayerDeathHandler(player, entityKiller, weapon); Weapons.Event_PlayerDeath(player, entityKiller, weapon); Army.Event_PlayerDeath(player, entityKiller, weapon); Police.Event_PlayerDeath(player, entityKiller, weapon); Houses.HouseManager.Event_OnPlayerDeath(player, entityKiller, weapon); Jobs.Collector.Event_PlayerDeath(player, entityKiller, weapon); Jobs.Gopostal.Event_PlayerDeath(player, entityKiller, weapon); VehicleManager.WarpPlayerOutOfVehicle(player); Main.Players[player].IsAlive = false; if (player.HasData("AdminSkin")) { player.ResetData("AdminSkin"); player.SetSkin((Main.Players[player].Gender) ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01); Customization.ApplyCharacter(player); } Trigger.ClientEvent(player, "screenFadeOut", 2000); var dimension = player.Dimension; if (Main.Players[player].DemorganTime != 0 || Main.Players[player].ArrestTime != 0) { player.SetData("IS_DYING", true); } if (!player.HasData("IS_DYING")) { if ((Manager.FractionTypes[Main.Players[player].FractionID] == 0 && (MafiaWars.warIsGoing || MafiaWars.warStarting)) || (Manager.FractionTypes[Main.Players[player].FractionID] == 1 && (GangsCapture.captureIsGoing || GangsCapture.captureStarting))) { player.SetSharedData("InDeath", true); DeathConfirm(player, false); } else { player.SetSharedData("InDeath", true); var medics = 0; foreach (var m in Manager.Members) { if (m.Value.FractionID == 8) { medics++; } } Trigger.ClientEvent(player, "openDialog", "DEATH_CONFIRM", $"Вы хотите вызвать медиков ({medics} в сети)?"); } } else { NAPI.Task.Run(() => { try { if (!Main.Players.ContainsKey(player)) { return; } if (player.HasData("DYING_TIMER")) { //Main.StopT(player.GetData("DYING_TIMER"), "timer_9"); Timers.Stop(player.GetData("DYING_TIMER")); player.ResetData("DYING_TIMER"); } if (player.HasData("CALLEMS_BLIP")) { NAPI.Entity.DeleteEntity(player.GetData("CALLEMS_BLIP")); player.ResetData("CALLEMS_BLIP"); } if (player.HasData("CALLEMS_COL")) { NAPI.ColShape.DeleteColShape(player.GetData("CALLEMS_COL")); player.ResetData("CALLEMS_COL"); } Trigger.ClientEvent(player, "DeathTimer", false); player.SetSharedData("InDeath", false); var spawnPos = new Vector3(); if (Main.Players[player].DemorganTime != 0) { spawnPos = Admin.DemorganPosition + new Vector3(0, 0, 1.12); dimension = 1337; } else if (Main.Players[player].ArrestTime != 0) { spawnPos = Police.policeCheckpoints[4]; } else if (Main.Players[player].FractionID == 14) { spawnPos = Fractions.Manager.FractionSpawns[14] + new Vector3(0, 0, 1.12); } else { player.SetData("IN_HOSPITAL", true); spawnPos = emsCheckpoints[2]; } NAPI.Player.SpawnPlayer(player, spawnPos); NAPI.Player.SetPlayerHealth(player, 20); player.ResetData("IS_DYING"); Main.Players[player].IsAlive = true; Main.OffAntiAnim(player); NAPI.Entity.SetEntityDimension(player, dimension); } catch { } }, 4000); } } catch (Exception e) { Log.Write("PlayerDeath: " + e.Message, nLog.Type.Error); } }
private static void callback_gpStartMenu(Client client, Menu menu, Menu.Item item, string eventName, dynamic data) { if (!Main.Players.ContainsKey(client) || client.Position.DistanceTo(Gopostal.Coords[0]) > 15) { MenuManager.Close(client); return; } switch (item.ID) { case "start": if (Main.Players[client].WorkID == 2) { if (!NAPI.Data.GetEntityData(client, "ON_WORK")) { if (Houses.HouseManager.Houses.Count == 0) { return; } client.SetData("PACKAGES", 10); Notify.Send(client, NotifyType.Info, NotifyPosition.BottomCenter, $"Вы получили 10 посылок, развезите их по домам", 3000); client.SetData("ON_WORK", true); client.SetData("W_LASTPOS", client.Position); client.SetData("W_LASTTIME", DateTime.Now); var next = Jobs.WorkManager.rnd.Next(0, Houses.HouseManager.Houses.Count - 1); while (Houses.HouseManager.Houses[next].Position.DistanceTo2D(client.Position) < 200) { next = Jobs.WorkManager.rnd.Next(0, Houses.HouseManager.Houses.Count - 1); } client.SetData("NEXTHOUSE", Houses.HouseManager.Houses[next].ID); Trigger.ClientEvent(client, "createCheckpoint", 1, 1, Houses.HouseManager.Houses[next].Position, 1, 0, 255, 0, 0); Trigger.ClientEvent(client, "createWaypoint", Houses.HouseManager.Houses[next].Position.X, Houses.HouseManager.Houses[next].Position.Y); Trigger.ClientEvent(client, "createWorkBlip", Houses.HouseManager.Houses[next].Position); var gender = Main.Players[client].Gender; Customization.ClearClothes(client, gender); if (gender) { Customization.SetHat(client, 76, 10); client.SetClothes(11, 38, 3); client.SetClothes(4, 17, 0); client.SetClothes(6, 1, 7); client.SetClothes(3, Core.Customization.CorrectTorso[gender][38], 0); } else { Customization.SetHat(client, 75, 10); client.SetClothes(11, 0, 6); client.SetClothes(4, 25, 2); client.SetClothes(6, 1, 2); client.SetClothes(3, Core.Customization.CorrectTorso[gender][0], 0); } int x = Jobs.WorkManager.rnd.Next(0, Gopostal.GoPostalObjects.Count); BasicSync.AttachObjectToPlayer(client, Jobs.Gopostal.GoPostalObjects[x], 60309, new Vector3(0.03, 0, 0.02), new Vector3(0, 0, 50)); } else { Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы уже начали рабочий день", 3000); } } else { Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не работаете курьером. Устроиться можно в мэрии", 3000); } return; case "get": { if (Main.Players[client].WorkID != 2) { Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не работаете курьером", 3000); return; } if (!client.GetData("ON_WORK")) { Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не начали рабочий день", 3000); return; } if (client.GetData("PACKAGES") != 0) { Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не раздали все посылки. У Вас осталось ещё {client.GetData("PACKAGES")} штук", 3000); return; } if (Houses.HouseManager.Houses.Count == 0) { return; } client.SetData("PACKAGES", 10); Notify.Send(client, NotifyType.Info, NotifyPosition.BottomCenter, $"Вы получили 10 посылок. Развезите их по домам", 3000); client.SetData("W_LASTPOS", client.Position); client.SetData("W_LASTTIME", DateTime.Now); var next = Jobs.WorkManager.rnd.Next(0, Houses.HouseManager.Houses.Count - 1); while (Houses.HouseManager.Houses[next].Position.DistanceTo2D(client.Position) < 200) { next = Jobs.WorkManager.rnd.Next(0, Houses.HouseManager.Houses.Count - 1); } client.SetData("NEXTHOUSE", Houses.HouseManager.Houses[next].ID); Trigger.ClientEvent(client, "createCheckpoint", 1, 1, Houses.HouseManager.Houses[next].Position, 1, 0, 255, 0, 0); Trigger.ClientEvent(client, "createWaypoint", Houses.HouseManager.Houses[next].Position.X, Houses.HouseManager.Houses[next].Position.Y); Trigger.ClientEvent(client, "createWorkBlip", Houses.HouseManager.Houses[next].Position); int y = Jobs.WorkManager.rnd.Next(0, Jobs.Gopostal.GoPostalObjects.Count); BasicSync.AttachObjectToPlayer(client, Jobs.Gopostal.GoPostalObjects[y], 60309, new Vector3(0.03, 0, 0.02), new Vector3(0, 0, 50)); return; } case "finish": if (Main.Players[client].WorkID == 2) { if (NAPI.Data.GetEntityData(client, "ON_WORK")) { Trigger.ClientEvent(client, "deleteCheckpoint", 1, 0); BasicSync.DetachObject(client); Notify.Send(client, NotifyType.Info, NotifyPosition.BottomCenter, $"Вы закончили рабочий день", 3000); Trigger.ClientEvent(client, "deleteWorkBlip"); client.SetData("PAYMENT", 0); Customization.ApplyCharacter(client); if (client.HasData("HAND_MONEY")) { client.SetClothes(5, 45, 0); } else if (client.HasData("HEIST_DRILL")) { client.SetClothes(5, 41, 0); } client.SetData("PACKAGES", 0); client.SetData("ON_WORK", false); if (client.GetData("WORK") != null) { NAPI.Entity.DeleteEntity(client.GetData("WORK")); client.SetData("WORK", null); } } else { Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не работаете", 3000); } } else { Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не работаете курьером", 3000); } return; case "close": MenuManager.Close(client); return; } }
public static void interactPressed(Client player, int interact) { switch (interact) { case 20: if (Main.Players[player].FractionID == 9) { if (!NAPI.Data.GetEntityData(player, "ON_DUTY")) { Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы начали рабочий день", 3000); Manager.setSkin(player, 9, Main.Players[player].FractionLVL); NAPI.Data.SetEntityData(player, "ON_DUTY", true); break; } else { Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы закончили рабочий день", 3000); Customization.ApplyCharacter(player); if (player.HasData("HAND_MONEY")) { player.SetClothes(5, 45, 0); } else if (player.HasData("HEIST_DRILL")) { player.SetClothes(5, 41, 0); } NAPI.Data.SetEntityData(player, "ON_DUTY", false); break; } } else { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник FBI", 3000); } return; case 21: if (player.IsInVehicle) { return; } if (player.HasData("FOLLOWING")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000); return; } NAPI.Entity.SetEntityPosition(player, ExitFBI + new Vector3(0, 0, 1.12)); Main.PlayerEnterInterior(player, ExitFBI + new Vector3(0, 0, 1.12)); return; case 22: if (player.IsInVehicle) { return; } if (player.HasData("FOLLOWING")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000); return; } NAPI.Entity.SetEntityPosition(player, EnterFBI + new Vector3(0, 0, 1.12)); Main.PlayerEnterInterior(player, EnterFBI + new Vector3(0, 0, 1.12)); return; case 23: if (player.IsInVehicle) { return; } if (player.HasData("FOLLOWING")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000); return; } OpenFbiLiftMenu(player); return; case 24: if (Main.Players[player].FractionID != 9) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник FBI", 3000); return; } if (!Stocks.fracStocks[9].IsOpen) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Склад закрыт", 3000); return; } OpenFbiGunMenu(player); return; case 26: NAPI.Entity.SetEntityPosition(player, fbiCheckpoints[3] + new Vector3(0, 0, 1.12)); return; case 27: NAPI.Entity.SetEntityPosition(player, fbiCheckpoints[2] + new Vector3(0, 0, 1.12)); return; case 46: if (Main.Players[player].FractionID != 9) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник FBI", 3000); return; } if (!player.GetData("ON_DUTY")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны начать рабочий день", 3000); return; } if (player.GetData("IN_CP_MODE")) { Manager.setSkin(player, Main.Players[player].FractionID, Main.Players[player].FractionLVL); player.SetData("IN_CP_MODE", false); Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы переоделись в рабочую форму", 3000); } else { if (!warg_mode) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Не включен режим ЧП", 3000); return; } if (Main.Players[player].Gender) { Customization.SetHat(player, 39, 2); player.SetClothes(11, 53, 1); player.SetClothes(4, 31, 2); player.SetClothes(6, 25, 0); player.SetClothes(9, 28, 9); player.SetClothes(8, 130, 0); player.SetClothes(3, 49, 0); } else { Customization.SetHat(player, 38, 2); player.SetClothes(11, 46, 1); player.SetClothes(4, 30, 2); player.SetClothes(6, 25, 0); player.SetClothes(9, 31, 9); player.SetClothes(8, 160, 0); player.SetClothes(3, 49, 0); } player.SetData("IN_CP_MODE", true); Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы переоделись в спец. форму", 3000); } return; case 61: if (Main.Players[player].FractionID != 9) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник полиции", 3000); return; } if (!NAPI.Data.GetEntityData(player, "ON_DUTY")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны начать рабочий день", 3000); return; } if (!Stocks.fracStocks[9].IsOpen) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Склад закрыт", 3000); return; } if (!Manager.canUseCommand(player, "openweaponstock")) { return; } player.SetData("ONFRACSTOCK", 9); GUI.Dashboard.OpenOut(player, Stocks.fracStocks[9].Weapons, "Склад оружия", 6); return; } }
public void Spawn(Client player) { try { NAPI.Task.Run(() => { try { player.SetSharedData("IS_MASK", false); // Logged in state, money, phone init Trigger.ClientEvent(player, "loggedIn"); player.SetData("LOGGED_IN", true); Trigger.ClientEvent(player, "UpdateMoney", Money); Trigger.ClientEvent(player, "UpdateBank", MoneySystem.Bank.Accounts[Bank].Balance); Trigger.ClientEvent(player, "initPhone"); Jobs.WorkManager.load(player); // Skin, Health, Armor, RemoteID player.SetSkin((Gender) ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01); player.Health = (Health > 5) ? Health : 5; player.Armor = Armor; player.SetSharedData("REMOTE_ID", player.Value); Voice.Voice.PlayerJoin(player); player.SetSharedData("voipmode", -1); if (Fractions.Manager.FractionTypes[FractionID] == 1 || AdminLVL > 0) { Fractions.GangsCapture.LoadBlips(player); } if (WantedLVL != null) { Trigger.ClientEvent(player, "setWanted", WantedLVL.Level); } player.SetData("RESIST_STAGE", 0); player.SetData("RESIST_TIME", 0); if (AdminLVL > 0) { player.SetSharedData("IS_ADMIN", true); } Dashboard.sendStats(player); Dashboard.sendItems(player); if (Main.Players[player].LVL == 0) { NAPI.Task.Run(() => { try { Trigger.ClientEvent(player, "disabledmg", true); } catch { } }, 5000); } House house = HouseManager.GetHouse(player); if (house != null) { // House blips & checkpoints house.PetName = Main.Players[player].PetName; Trigger.ClientEvent(player, "changeBlipColor", house.blip, 73); Trigger.ClientEvent(player, "createCheckpoint", 333, 1, GarageManager.Garages[house.GarageID].Position - new Vector3(0, 0, 1.12), 1, NAPI.GlobalDimension, 220, 220, 0); Trigger.ClientEvent(player, "createGarageBlip", GarageManager.Garages[house.GarageID].Position); } if (!Customization.CustomPlayerData.ContainsKey(UUID) || !Customization.CustomPlayerData[UUID].IsCreated) { Trigger.ClientEvent(player, "spawnShow", false); Customization.CreateCharacter(player); } else { try { NAPI.Entity.SetEntityPosition(player, Main.Players[player].SpawnPos); List <bool> prepData = new List <bool> { true, (FractionID > 0) ? true : false, (house != null || HotelID != -1) ? true : false, }; Trigger.ClientEvent(player, "spawnShow", JsonConvert.SerializeObject(prepData)); Customization.ApplyCharacter(player); } catch { } } } catch (Exception e) { Log.Write($"EXCEPTION AT \"Spawn.NAPI.Task.Run\":\n" + e.ToString(), nLog.Type.Error); } }); if (Warns > 0 && DateTime.Now > Unwarn) { Warns--; if (Warns > 0) { Unwarn = DateTime.Now.AddDays(14); } Notify.Send(player, NotifyType.Warning, NotifyPosition.BottomCenter, $"Одно предупреждение было снято. У Вас осталось {Warns}", 3000); } if (!Dashboard.isopen.ContainsKey(player)) { Dashboard.isopen.Add(player, false); } nInventory.Check(UUID); if (nInventory.Find(UUID, ItemType.BagWithMoney) != null) { nInventory.Remove(player, ItemType.BagWithMoney, 1); } if (nInventory.Find(UUID, ItemType.BagWithDrill) != null) { nInventory.Remove(player, ItemType.BagWithDrill, 1); } if (FractionID == 15) { Trigger.ClientEvent(player, "enableadvert", true); Fractions.LSNews.onLSNPlayerLoad(player); } if (AdminLVL > 0) { ReportSys.onAdminLoad(player); } } catch (Exception e) { Log.Write("EXCEPTION AT \"Spawn\":\n" + e.ToString()); } }
private static void callback_policeSpecial(Client client, Menu menu, Menu.Item item, string eventName, dynamic data) { switch (item.ID) { case "changeclothes": if (!NAPI.Data.GetEntityData(client, "IN_CP_MODE")) { bool gender = Main.Players[client].Gender; Customization.ApplyCharacter(client); Customization.ClearClothes(client, gender); if (gender) { Customization.SetHat(client, 39, 0); //client.SetClothes(1, 52, 0); client.SetClothes(11, 53, 0); client.SetClothes(4, 31, 0); client.SetClothes(6, 25, 0); client.SetClothes(9, 15, 2); client.SetClothes(3, 49, 0); } else { Customization.SetHat(client, 38, 0); //client.SetClothes(1, 57, 0); client.SetClothes(11, 46, 0); client.SetClothes(4, 30, 0); client.SetClothes(6, 25, 0); client.SetClothes(9, 17, 2); client.SetClothes(3, 53, 0); } if (client.HasData("HAND_MONEY")) { client.SetClothes(5, 45, 0); } else if (client.HasData("HEIST_DRILL")) { client.SetClothes(5, 41, 0); } NAPI.Data.SetEntityData(client, "IN_CP_MODE", true); return; } Fractions.Manager.setSkin(client, 7, Main.Players[client].FractionLVL); client.SetData("IN_CP_MODE", false); return; case "pistol50": Fractions.Manager.giveGun(client, Weapons.Hash.Pistol50, "pistol50"); return; case "carbineRifle": Fractions.Manager.giveGun(client, Weapons.Hash.CarbineRifle, "carbineRifle"); return; case "riflesammo": if (!Manager.canGetWeapon(client, "RiflesAmmo")) { return; } Fractions.Manager.giveAmmo(client, ItemType.RiflesAmmo, 30); return; case "heavyshotgun": Fractions.Manager.giveGun(client, Weapons.Hash.HeavyShotgun, "heavyshotgun"); return; case "stungun": Fractions.Manager.giveGun(client, Weapons.Hash.StunGun, "stungun"); return; case "close": MenuManager.Close(client); return; } }
public static void interactPressed(Client player, int interact) { if (!Main.Players.ContainsKey(player)) { return; } switch (interact) { case 10: if (Main.Players[player].FractionID != 7) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник полиции", 3000); return; } if (!Stocks.fracStocks[7].IsOpen) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Склад закрыт", 3000); return; } if (!NAPI.Data.GetEntityData(player, "ON_DUTY")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны начать рабочий день", 3000); return; } OpenPoliceGunMenu(player); return; case 11: if (Main.Players[player].FractionID == 7) { if (!NAPI.Data.GetEntityData(player, "ON_DUTY")) { Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы начали рабочий день", 3000); Manager.setSkin(player, 7, Main.Players[player].FractionLVL); NAPI.Data.SetEntityData(player, "ON_DUTY", true); break; } else { Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы закончили рабочий день", 3000);; Customization.ApplyCharacter(player); if (player.HasData("HAND_MONEY")) { player.SetClothes(5, 45, 0); } else if (player.HasData("HEIST_DRILL")) { player.SetClothes(5, 41, 0); } NAPI.Data.SetEntityData(player, "ON_DUTY", false); break; } } else { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник полиции", 3000); } return; case 12: if (Main.Players[player].FractionID != 7) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник полиции", 3000); return; } if (!NAPI.Data.GetEntityData(player, "ON_DUTY")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны начать рабочий день", 3000); return; } if (!is_warg) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Не включен режим ЧП", 3000); return; } OpenSpecialPoliceMenu(player); return; case 42: if (!player.HasData("HAND_MONEY") && !player.HasData("HEIST_DRILL")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас нет ни сумки с деньгами, ни сумки с дрелью", 3000); return; } if (player.HasData("HAND_MONEY")) { nInventory.Remove(player, ItemType.BagWithMoney, 1); player.SetClothes(5, 0, 0); player.ResetData("HAND_MONEY"); } if (player.HasData("HEIST_DRILL")) { nInventory.Remove(player, ItemType.BagWithDrill, 1); player.SetClothes(5, 0, 0); player.ResetData("HEIST_DRILL"); } MoneySystem.Wallet.Change(player, 200); GameLog.Money($"server", $"player({Main.Players[player].UUID})", 200, $"policeAward"); Notify.Send(player, NotifyType.Info, NotifyPosition.BottomCenter, $"Вы получили вознаграждение в 200$", 3000); return; case 44: if (Main.Players[player].Licenses[6]) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас уже есть лицензия на оружие", 3000); return; } if (!MoneySystem.Wallet.Change(player, -30000)) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас недостаточно средств.", 3000); return; } Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы купили лицензию на оружие", 3000); Main.Players[player].Licenses[6] = true; Dashboard.sendStats(player); return; case 59: if (Main.Players[player].FractionID != 7) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник полиции", 3000); return; } if (!NAPI.Data.GetEntityData(player, "ON_DUTY")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны начать рабочий день", 3000); return; } if (!Stocks.fracStocks[7].IsOpen) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Склад закрыт", 3000); return; } if (!Manager.canUseCommand(player, "openweaponstock")) { return; } player.SetData("ONFRACSTOCK", 7); GUI.Dashboard.OpenOut(player, Stocks.fracStocks[7].Weapons, "Склад оружия", 6); return; case 66: if (Main.Players[player].FractionID != 7) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник полиции", 3000); return; } if (!NAPI.Data.GetEntityData(player, "ON_DUTY")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны начать рабочий день", 3000); return; } if (!player.IsInVehicle || (player.Vehicle.Model != NAPI.Util.GetHashKey("police") && player.Vehicle.Model != NAPI.Util.GetHashKey("police2") && player.Vehicle.Model != NAPI.Util.GetHashKey("police3") && player.Vehicle.Model != NAPI.Util.GetHashKey("police4"))) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны находиться в рабочей машине", 3000); return; } Trigger.ClientEvent(player, "svem", 20, 20); player.Vehicle.SetSharedData("BOOST", 20); Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Пробущено", 3000); return; } }