diff --git a/ReallifeGamemode.Client/admin/aspeed.ts b/ReallifeGamemode.Client/admin/aspeed.ts index 673af7ba..880762c5 100644 --- a/ReallifeGamemode.Client/admin/aspeed.ts +++ b/ReallifeGamemode.Client/admin/aspeed.ts @@ -1,6 +1,9 @@ import { VehicleSeat } from "../game"; export default function () { + + var TorqueEntity + var TorqueValue = 1; mp.events.addDataHandler("vehicleAdminSpeed", (entity, newValue) => { if (!entity.isAVehicle()) return; entity.setEnginePowerMultiplier(newValue); @@ -9,7 +12,13 @@ export default function () { mp.events.addDataHandler("vehicleAdminSpeed2", (entity, newValue2) => { if (!entity.isAVehicle()) return; mp.gui.chat.push("Debug1"); - entity.setEngineTorqueMultiplier(newValue2); + //entity.setEngineTorqueMultiplier(newValue2); + TorqueEntity = entity; + TorqueValue = newValue2; mp.gui.chat.push("Debug2"); }); + /*mp.events.add('render', () => { + let vehicle = mp.players.local.vehicle; + vehicle.setEngineTorqueMultiplier(1.5); // Multiplies by 1.5 the engine torque + });*/ } \ No newline at end of file diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index bccdfd4e..b75432fb 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -2684,11 +2684,11 @@ namespace ReallifeGamemode.Server.Commands return; } - if (modifier < 0) + /*if (modifier < 0) { ChatService.ErrorMessage(player, "Es muss positives Adminspeed angegeben werden"); return; - } + }*/ player.Vehicle.SetSharedData("vehicleAdminSpeed", modifier); player.Vehicle.SetSharedData("vehicleAdminSpeed2", modifier2); diff --git a/ReallifeGamemode.Server/Events/Connect.cs b/ReallifeGamemode.Server/Events/Connect.cs index ad6f258c..8b725dfb 100644 --- a/ReallifeGamemode.Server/Events/Connect.cs +++ b/ReallifeGamemode.Server/Events/Connect.cs @@ -21,6 +21,8 @@ namespace ReallifeGamemode.Server.Events [ServerEvent(Event.PlayerConnected)] public void OnPlayerConnected(Player player) { + player.TriggerEvent("CLIENT:StopSound"); + //player.SetSharedData("vehicleAdminSpeed2", 1.0); player.SetData("isLoggedIn", false); player.Position = new Vector3(-1883.736, -781.4911, -10); diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index 298fdedf..003e98b1 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -172,17 +172,17 @@ namespace ReallifeGamemode.Server.Events if (!player.IsLoggedIn()) return; var user = player.GetUser(); + ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3)); + ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData("duty"))); + + ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5); + JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5); if (user?.FactionId != null) { DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5 && d.FactionId == user.FactionId); WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId); JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData("duty")); - ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3)); - ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData("duty"))); - - ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5); - JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5); if (nearestDuty != null)// Duty Point @@ -262,62 +262,7 @@ namespace ReallifeGamemode.Server.Events UpdateCharacterCloth.LoadCharacterDefaults(player); } } - if (nearestJobPoint != null) - { - Job.JobBase job = JobManager.GetJob(player.GetUser().JobId.Value); - JobManager jobb = new JobManager(); - if (nearestJobPoint.jobId != 3 && nearestJobPoint.jobId == player.GetUser().JobId) - { - if (job.GetUsersInJob().Contains(player)) - { - jobb.StopJob(player); - return; - } - if (!job.GetUsersInJob().Contains(player)) - { - jobb.StartJobEvent(player); - return; - } - } - if (nearestJobPoint.jobId == 3 && player.GetUser().JobId == 3) - { - if (nearestJobPoint.Skill < 300 && player.GetUser().PilotSkill < 300) - { - if (job.GetUsersInJob().Contains(player)) - { - jobb.StopJob(player); - user.SetData("PilotenBase2", false); - return; - } - if (!job.GetUsersInJob().Contains(player)) - { - jobb.StartJobEvent(player); - user.SetData("PilotenBase2", false); - return; - } - } - if (nearestJobPoint.Skill >= 300 && player.GetUser().PilotSkill >= 300) - { - if (job.GetUsersInJob().Contains(player)) - { - jobb.StopJob(player); - user.SetData("PilotenBase2", false); - return; - } - if (!job.GetUsersInJob().Contains(player)) - { - jobb.StartJobEvent(player); - user.SetData("PilotenBase2", true); - return; - } - } - else - { - player.SendChatMessage("~y~[JOB] ~r~Dein Skilllevel ist noch zu niedrig."); - return; - } - } - } + if (nearestWeapon != null) // Weapon Point { @@ -404,29 +349,85 @@ namespace ReallifeGamemode.Server.Events } player.TriggerEvent("showJailMenu", JsonConvert.SerializeObject(criminals.ToArray())); } - if (nearestElevatorPoint != null) + } + if (nearestElevatorPoint != null) + { + List stages = new List(); + foreach (var e in PositionManager.ElevatorPoints) { - List stages = new List(); - foreach (var e in PositionManager.ElevatorPoints) + if (e.Position.DistanceTo2D(player.Position) <= 25 && e.Position.DistanceTo(player.Position) > 1.5) { - if (e.Position.DistanceTo2D(player.Position) <= 25 && e.Position.DistanceTo(player.Position) > 1.5) + stages.Add(e.Stage); + } + } + player.TriggerEvent("showElevatorMenu", JsonConvert.SerializeObject(stages.ToArray())); + } + if (nearestClotheShopPoint != null) + { + nearestClotheShopPoint.clotheShop.LoadShopNUI(player); + } + if (nearestItemShopPoint != null) + { + nearestItemShopPoint.itemShop.LoadShopNUI(player); + } + if (user.FactionLeader) + { + player.TriggerEvent("CLIENT:StartGangwar"); + } + if (nearestJobPoint != null) + { + Job.JobBase job = JobManager.GetJob(player.GetUser().JobId.Value); + JobManager jobb = new JobManager(); + if (nearestJobPoint.jobId != 3 && nearestJobPoint.jobId == player.GetUser().JobId) + { + if (job.GetUsersInJob().Contains(player)) + { + jobb.StopJob(player); + return; + } + if (!job.GetUsersInJob().Contains(player)) + { + jobb.StartJobEvent(player); + return; + } + } + if (nearestJobPoint.jobId == 3 && player.GetUser().JobId == 3) + { + if (nearestJobPoint.Skill < 300 && player.GetUser().PilotSkill < 300) + { + if (job.GetUsersInJob().Contains(player)) { - stages.Add(e.Stage); + jobb.StopJob(player); + user.SetData("PilotenBase2", false); + return; + } + if (!job.GetUsersInJob().Contains(player)) + { + jobb.StartJobEvent(player); + user.SetData("PilotenBase2", false); + return; } } - player.TriggerEvent("showElevatorMenu", JsonConvert.SerializeObject(stages.ToArray())); - } - if (nearestClotheShopPoint != null) - { - nearestClotheShopPoint.clotheShop.LoadShopNUI(player); - } - if (nearestItemShopPoint != null) - { - nearestItemShopPoint.itemShop.LoadShopNUI(player); - } - if (user.FactionLeader) - { - player.TriggerEvent("CLIENT:StartGangwar"); + if (nearestJobPoint.Skill >= 300 && player.GetUser().PilotSkill >= 300) + { + if (job.GetUsersInJob().Contains(player)) + { + jobb.StopJob(player); + user.SetData("PilotenBase2", false); + return; + } + if (!job.GetUsersInJob().Contains(player)) + { + jobb.StartJobEvent(player); + user.SetData("PilotenBase2", true); + return; + } + } + else + { + player.SendChatMessage("~y~[JOB] ~r~Dein Skilllevel ist noch zu niedrig."); + return; + } } } }