static void Main(string[] args) { SafeMain.ParseArgumentsAndRunInTryCatch <Options>(args, CreateScript); }
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); } }
public static void interactPressed(Client player, int interact) { switch (interact) { case 3: if (Main.Players[player].FractionID == 6 && Main.Players[player].FractionLVL > 1) { Doormanager.SetDoorLocked(player.GetData("DOOR"), !Doormanager.GetDoorLocked(player.GetData("DOOR")), 0); string msg = "Вы открыли дверь"; if (Doormanager.GetDoorLocked(player.GetData("DOOR"))) { msg = "Вы закрыли дверь"; } Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, msg, 3000); } return; case 4: SafeMain.OpenSafedoorMenu(player); return; case 5: if (player.IsInVehicle) { return; } if (player.HasData("FOLLOWING")) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000); return; } if (player.Position.Z < 50) { NAPI.Entity.SetEntityPosition(player, CityhallCheckpoints[3] + new Vector3(0, 0, 1.12)); Main.PlayerEnterInterior(player, CityhallCheckpoints[3] + new Vector3(0, 0, 1.12)); } else { NAPI.Entity.SetEntityPosition(player, CityhallCheckpoints[2] + new Vector3(0, 0, 1.12)); Main.PlayerEnterInterior(player, CityhallCheckpoints[2] + new Vector3(0, 0, 1.12)); } return; case 62: if (Main.Players[player].FractionID != 6) { 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[6].IsOpen) { Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Склад закрыт", 3000); return; } if (!Manager.canUseCommand(player, "openweaponstock")) { return; } player.SetData("ONFRACSTOCK", 6); GUI.Dashboard.OpenOut(player, Stocks.fracStocks[6].Weapons, "Склад оружия", 6); return; } }