Fix E-Job Starten

This commit is contained in:
Mac_Slash
2020-04-30 15:56:05 +02:00
parent ec25d1c476
commit 10cd220708
4 changed files with 94 additions and 82 deletions

View File

@@ -1,6 +1,9 @@
import { VehicleSeat } from "../game"; import { VehicleSeat } from "../game";
export default function () { export default function () {
var TorqueEntity
var TorqueValue = 1;
mp.events.addDataHandler("vehicleAdminSpeed", (entity, newValue) => { mp.events.addDataHandler("vehicleAdminSpeed", (entity, newValue) => {
if (!entity.isAVehicle()) return; if (!entity.isAVehicle()) return;
entity.setEnginePowerMultiplier(newValue); entity.setEnginePowerMultiplier(newValue);
@@ -9,7 +12,13 @@ export default function () {
mp.events.addDataHandler("vehicleAdminSpeed2", (entity, newValue2) => { mp.events.addDataHandler("vehicleAdminSpeed2", (entity, newValue2) => {
if (!entity.isAVehicle()) return; if (!entity.isAVehicle()) return;
mp.gui.chat.push("Debug1"); mp.gui.chat.push("Debug1");
entity.setEngineTorqueMultiplier(newValue2); //entity.setEngineTorqueMultiplier(newValue2);
TorqueEntity = entity;
TorqueValue = newValue2;
mp.gui.chat.push("Debug2"); 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
});*/
} }

View File

@@ -2684,11 +2684,11 @@ namespace ReallifeGamemode.Server.Commands
return; return;
} }
if (modifier < 0) /*if (modifier < 0)
{ {
ChatService.ErrorMessage(player, "Es muss positives Adminspeed angegeben werden"); ChatService.ErrorMessage(player, "Es muss positives Adminspeed angegeben werden");
return; return;
} }*/
player.Vehicle.SetSharedData("vehicleAdminSpeed", modifier); player.Vehicle.SetSharedData("vehicleAdminSpeed", modifier);
player.Vehicle.SetSharedData("vehicleAdminSpeed2", modifier2); player.Vehicle.SetSharedData("vehicleAdminSpeed2", modifier2);

View File

@@ -21,6 +21,8 @@ namespace ReallifeGamemode.Server.Events
[ServerEvent(Event.PlayerConnected)] [ServerEvent(Event.PlayerConnected)]
public void OnPlayerConnected(Player player) public void OnPlayerConnected(Player player)
{ {
player.TriggerEvent("CLIENT:StopSound");
//player.SetSharedData("vehicleAdminSpeed2", 1.0);
player.SetData("isLoggedIn", false); player.SetData("isLoggedIn", false);
player.Position = new Vector3(-1883.736, -781.4911, -10); player.Position = new Vector3(-1883.736, -781.4911, -10);

View File

@@ -172,17 +172,17 @@ namespace ReallifeGamemode.Server.Events
if (!player.IsLoggedIn()) return; if (!player.IsLoggedIn()) return;
var user = player.GetUser(); 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<bool>("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) if (user?.FactionId != null)
{ {
DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5 && d.FactionId == user.FactionId); 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); 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<bool>("duty")); JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData<bool>("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<bool>("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 if (nearestDuty != null)// Duty Point
@@ -262,62 +262,7 @@ namespace ReallifeGamemode.Server.Events
UpdateCharacterCloth.LoadCharacterDefaults(player); 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 if (nearestWeapon != null) // Weapon Point
{ {
@@ -404,6 +349,7 @@ namespace ReallifeGamemode.Server.Events
} }
player.TriggerEvent("showJailMenu", JsonConvert.SerializeObject(criminals.ToArray())); player.TriggerEvent("showJailMenu", JsonConvert.SerializeObject(criminals.ToArray()));
} }
}
if (nearestElevatorPoint != null) if (nearestElevatorPoint != null)
{ {
List<string> stages = new List<string>(); List<string> stages = new List<string>();
@@ -428,6 +374,61 @@ namespace ReallifeGamemode.Server.Events
{ {
player.TriggerEvent("CLIENT:StartGangwar"); 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))
{
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;
}
}
} }
} }