Busfahrer und PilotenSystem überarbeitet, LoginAmbiente eingefügt, Überarbeitung der Türen
This commit is contained in:
@@ -148,10 +148,11 @@ namespace ReallifeGamemode.Server.Managers
|
||||
}
|
||||
|
||||
}
|
||||
JobPoint nearJobPoint = PositionManager.jobPoints.Find(p => p.Position.DistanceTo(player.Position) <= 2);
|
||||
if (nearJobPoint == null && u.JobId == 2) return;
|
||||
|
||||
|
||||
//JobPoint nearJobPoint = PositionManager.JobPoints.Find(p => p.Position.DistanceTo(player.Position) <= 2);
|
||||
if(u.JobId == 2 || u.JobId == 3 || u.JobId == 4)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var json = JsonConvert.SerializeObject(data);
|
||||
|
||||
@@ -181,7 +182,34 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
job.StartJob(player);
|
||||
}
|
||||
Vehicle LastVehicle;
|
||||
[ServerEvent(Event.PlayerExitVehicle)]
|
||||
public void JobManagerPlayerExitVehicle(Player player, Vehicle veh)
|
||||
{
|
||||
User u = player.GetUser();
|
||||
|
||||
if (u.JobId == null) return;
|
||||
|
||||
JobBase job = GetJob(u.JobId.Value);
|
||||
if (veh.GetServerVehicle() is JobVehicle vehJ && player.VehicleSeat == 0)
|
||||
{
|
||||
if (vehJ.GetJob().GetUsersInJob().Contains(player))
|
||||
{
|
||||
if (u.JobId != 2)
|
||||
{
|
||||
timerJobVehicleRespawn.Start();
|
||||
veh.SetData("timerJobVehicleRespawn", true);
|
||||
LastVehicle = veh;
|
||||
timerJobVehicleRespawn.AutoReset = false;
|
||||
timerJobVehicleRespawn.Elapsed += Timer30000_Elapsed;
|
||||
player.SendChatMessage("~y~[JOB] ~w~Du hast das Fahrzeug verlassen,");
|
||||
player.SendChatMessage("~y~[JOB] ~w~Bist du nicht in 30 Sekunden zurück, ~r~wird der Job beendet!");
|
||||
//job.StopJob(player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
[RemoteEvent("CLIENT:Job_StopJob")]
|
||||
public void StopJob(Player player)
|
||||
{
|
||||
@@ -205,11 +233,11 @@ namespace ReallifeGamemode.Server.Managers
|
||||
//if (LastVehicle.GetData<bool>("timerJobVehicleRespawn") == true)
|
||||
//Vehicle v = player.Vehicle;
|
||||
job.StopJob(player);
|
||||
if (player.GetUser().JobId == 1)//Taxifahrer
|
||||
/*if (player.GetUser().JobId == 1)//Taxifahrer
|
||||
{
|
||||
player.Position = new Vector3(-628.598388671875, -2107.609130859375, 6.072586536407471);
|
||||
player.Heading = (-171.50303649902344f);
|
||||
}
|
||||
}*/
|
||||
if (player.GetUser().JobId == 2)//Müllmann
|
||||
{
|
||||
player.Position = new Vector3(-428.9902038574219, -1726.5357666015625, 19.783836364746094);
|
||||
@@ -217,101 +245,59 @@ namespace ReallifeGamemode.Server.Managers
|
||||
}
|
||||
if (player.GetUser().JobId == 3)//Pilot
|
||||
{
|
||||
if (player.IsInVehicle)
|
||||
/*if (LastVehicle != null)
|
||||
{
|
||||
if ((VehicleHash)player.Vehicle.Model == VehicleHash.Cuban800)
|
||||
if ((VehicleHash)LastVehicle.Model == VehicleHash.Cuban800)
|
||||
{
|
||||
player.Position = new Vector3(1707.2711181640625, 3276.216064453125, 41.155494689941406);
|
||||
player.Heading = (-154.65234375f);
|
||||
}
|
||||
if ((VehicleHash)player.Vehicle.Model == VehicleHash.Velum || (VehicleHash)player.Vehicle.Model == VehicleHash.Velum2)
|
||||
if ((VehicleHash)LastVehicle.Model == VehicleHash.Velum || (VehicleHash)LastVehicle.Model == VehicleHash.Velum2)
|
||||
{
|
||||
player.Position = new Vector3(-1615.156982421875, -3140.54833984375, 13.991917610168457);
|
||||
player.Heading = (60.65372848510742f);
|
||||
}
|
||||
}
|
||||
else
|
||||
}*/
|
||||
if (!player.HasData("PilotenBase2") || player.GetData<bool>("PilotenBase2") == false) //Sandyshores
|
||||
{
|
||||
if (LastVehicle != null)
|
||||
{
|
||||
if ((VehicleHash)LastVehicle.Model == VehicleHash.Cuban800)
|
||||
{
|
||||
player.Position = new Vector3(1707.2711181640625, 3276.216064453125, 41.155494689941406);
|
||||
player.Heading = (-154.65234375f);
|
||||
}
|
||||
if ((VehicleHash)LastVehicle.Model == VehicleHash.Velum || (VehicleHash)LastVehicle.Model == VehicleHash.Velum2)
|
||||
{
|
||||
player.Position = new Vector3(-1615.156982421875, -3140.54833984375, 13.991917610168457);
|
||||
player.Heading = (60.65372848510742f);
|
||||
}
|
||||
}
|
||||
player.Position = new Vector3(1707.2711181640625, 3276.216064453125, 41.155494689941406);
|
||||
player.Heading = (-154.65234375f);
|
||||
}
|
||||
if (player.HasData("PilotenBase2") && player.GetData<bool>("PilotenBase2") == true) //LS Airport
|
||||
{
|
||||
player.Position = new Vector3(-1622.48, -3151.58, 13);
|
||||
player.Heading = (48.44f);
|
||||
}
|
||||
}
|
||||
if (player.GetUser().JobId == 4)//Busfahrer
|
||||
{
|
||||
if (player.IsInVehicle)
|
||||
/*if (LastVehicle != null)
|
||||
{
|
||||
if ((VehicleHash)player.Vehicle.Model == VehicleHash.Bus || (VehicleHash)player.Vehicle.Model == VehicleHash.Coach)
|
||||
if ((VehicleHash)LastVehicle.Model == VehicleHash.Bus || (VehicleHash)LastVehicle.Model == VehicleHash.Coach)
|
||||
{
|
||||
player.Position = new Vector3(-604.0092163085938, -2229.08447265625, 6.004401683807373);
|
||||
player.Heading = (17.64179039001465f);
|
||||
}
|
||||
if ((VehicleHash)player.Vehicle.Model == VehicleHash.Tourbus)
|
||||
if ((VehicleHash)LastVehicle.Model == VehicleHash.Tourbus)
|
||||
{
|
||||
player.Position = new Vector3(458.98468017578125, -657.942138671875, 27.58537483215332);
|
||||
player.Heading = (-8.147048950195312f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LastVehicle != null)
|
||||
{
|
||||
if ((VehicleHash)LastVehicle.Model == VehicleHash.Bus || (VehicleHash)LastVehicle.Model == VehicleHash.Coach)
|
||||
{
|
||||
player.Position = new Vector3(-604.0092163085938, -2229.08447265625, 6.004401683807373);
|
||||
player.Heading = (17.64179039001465f);
|
||||
}
|
||||
if ((VehicleHash)LastVehicle.Model == VehicleHash.Tourbus)
|
||||
{
|
||||
player.Position = new Vector3(458.98468017578125, -657.942138671875, 27.58537483215332);
|
||||
player.Heading = (-8.147048950195312f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
player.Position = new Vector3(-535.46, -2144.97, 5.95);
|
||||
player.Heading = (57.03f);
|
||||
}
|
||||
ServerVehicle sVeh = VehicleManager.GetServerVehicleFromVehicle(LastVehicle);
|
||||
ServerVehicleExtensions.Spawn(sVeh, LastVehicle);
|
||||
if (LastVehicle != null)
|
||||
{
|
||||
LastVehicle.ResetData("timerJobVehicleRespawn");
|
||||
ServerVehicle sVeh = VehicleManager.GetServerVehicleFromVehicle(LastVehicle);
|
||||
ServerVehicleExtensions.Spawn(sVeh, LastVehicle);
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ LastVehicle1: {LastVehicle}");
|
||||
}
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ LastVehicle2: {LastVehicle}");
|
||||
CheckPointHandle.DeleteCheckpoints(player);
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{job.Name}~s~ beendet.");
|
||||
}
|
||||
Vehicle LastVehicle;
|
||||
[ServerEvent(Event.PlayerExitVehicle)]
|
||||
public void JobManagerPlayerExitVehicle(Player player, Vehicle veh)
|
||||
{
|
||||
User u = player.GetUser();
|
||||
|
||||
if (u.JobId == null) return;
|
||||
|
||||
JobBase job = GetJob(u.JobId.Value);
|
||||
if (veh.GetServerVehicle() is JobVehicle vehJ)
|
||||
{
|
||||
if (vehJ.GetJob().GetUsersInJob().Contains(player) && job.NeedVehicleToStart)
|
||||
{
|
||||
if (u.JobId != 2)
|
||||
{
|
||||
timerJobVehicleRespawn.Start();
|
||||
veh.SetData("timerJobVehicleRespawn", true);
|
||||
LastVehicle = veh;
|
||||
timerJobVehicleRespawn.AutoReset = false;
|
||||
timerJobVehicleRespawn.Elapsed += Timer30000_Elapsed;
|
||||
player.SendChatMessage("~y~[JOB] ~w~Du hast das Fahrzeug verlassen,");
|
||||
player.SendChatMessage("~y~[JOB] ~w~Bist du nicht in 30 Sekunden zurück, ~r~wird der Job beendet!");
|
||||
//job.StopJob(player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Timer30000_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
NAPI.Task.Run(() =>
|
||||
@@ -335,7 +321,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
LastVehicle.ResetData("timerJobVehicleRespawn");
|
||||
CheckPointHandle.DeleteCheckpoints(p);
|
||||
ServerVehicleExtensions.Spawn(sVeh, LastVehicle);
|
||||
if (p.GetData<bool>("isDead") == true)
|
||||
if (p.GetData<bool>("isDead") == false)
|
||||
{
|
||||
if (p.GetUser().JobId == 1)//Taxifahrer
|
||||
{
|
||||
@@ -347,31 +333,21 @@ namespace ReallifeGamemode.Server.Managers
|
||||
}
|
||||
if (p.GetUser().JobId == 3)//Pilot
|
||||
{
|
||||
if ((VehicleHash)LastVehicle.Model == VehicleHash.Cuban800)
|
||||
if (!p.HasData("PilotenBase2") || p.GetData<bool>("PilotenBase2") == false) //Sandyshores
|
||||
{
|
||||
p.Position = new Vector3(1707.2711181640625, 3276.216064453125, 41.155494689941406);
|
||||
p.Heading = (-154.65234375f);
|
||||
}
|
||||
if ((VehicleHash)LastVehicle.Model == VehicleHash.Velum || (VehicleHash)LastVehicle.Model == VehicleHash.Velum2)
|
||||
if (p.HasData("PilotenBase2") && p.GetData<bool>("PilotenBase2") == true) //LS Airport
|
||||
{
|
||||
p.Position = new Vector3(-1615.156982421875, -3140.54833984375, 13.991917610168457);
|
||||
p.Heading = (60.65372848510742f);
|
||||
p.Position = new Vector3(-1622.48, -3151.58, 13);
|
||||
p.Heading = (48.44f);
|
||||
}
|
||||
//VehicleManager.DeleteVehicle(v);
|
||||
}
|
||||
if (p.GetUser().JobId == 4) //Busfahrer
|
||||
if (p.GetUser().JobId == 4)//Busfahrer
|
||||
{
|
||||
if ((VehicleHash)LastVehicle.Model == VehicleHash.Bus || (VehicleHash)LastVehicle.Model == VehicleHash.Coach)
|
||||
{
|
||||
p.Position = new Vector3(-604.0092163085938, -2229.08447265625, 6.004401683807373);
|
||||
p.Heading = (17.64179039001465f);
|
||||
}
|
||||
if ((VehicleHash)LastVehicle.Model == VehicleHash.Tourbus)
|
||||
{
|
||||
p.Position = new Vector3(458.98468017578125, -657.942138671875, 27.58537483215332);
|
||||
p.Heading = (-8.147048950195312f);
|
||||
}
|
||||
//VehicleManager.DeleteVehicle(v);
|
||||
p.Position = new Vector3(-535.46, -2144.97, 5.95);
|
||||
p.Heading = (57.03f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -431,15 +407,19 @@ namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
if (sVeh is JobVehicle JV)
|
||||
{
|
||||
JobVehicle c = new JobVehicle();
|
||||
if (JV.GetJob().GetUsersInJob().Contains(player))
|
||||
if (seat == 0)
|
||||
{
|
||||
timerJobVehicleRespawn.Stop();
|
||||
veh.SetData("timerJobVehicleRespawn", false);
|
||||
JobVehicle c = new JobVehicle();
|
||||
if (JV.GetJob().GetUsersInJob().Contains(player))
|
||||
{
|
||||
timerJobVehicleRespawn.Stop();
|
||||
veh.SetData("timerJobVehicleRespawn", false);
|
||||
}
|
||||
}
|
||||
else return;
|
||||
}
|
||||
}
|
||||
else return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -463,7 +443,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
}
|
||||
|
||||
[ServerEvent(Event.PlayerExitVehicle)]
|
||||
public void JobManagerPlayerEnterVehicle(Player player, Vehicle veh)
|
||||
public void JobManagerPlayerExitVehicle2(Player player, Vehicle veh)
|
||||
{
|
||||
ServerVehicle sVeh = veh.GetServerVehicle();
|
||||
if (sVeh == null) return;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
public static List<ItemshopPoint> itemshopPoints = new List<ItemshopPoint>();
|
||||
|
||||
public static List<JobPoint> jobPoints = new List<JobPoint>();
|
||||
public static List<JobPoint> JobPoints = new List<JobPoint>();
|
||||
|
||||
[ServerEvent(Event.ResourceStart)]
|
||||
public void OnResourceStart()
|
||||
@@ -117,7 +117,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
#endregion JailReleasePoints
|
||||
|
||||
#region ElevetaorPoints
|
||||
#region ElevatorPoints
|
||||
|
||||
ElevatorPoint FibElevatorPointEG = new ElevatorPoint()
|
||||
{
|
||||
@@ -149,24 +149,69 @@ namespace ReallifeGamemode.Server.Managers
|
||||
NAPI.TextLabel.CreateTextLabel("Aufzug - Dr\u00fccke ~y~E", j.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
}
|
||||
|
||||
#endregion ElevetaorPoints
|
||||
#endregion ElevatorPoints
|
||||
|
||||
#region JobPoints
|
||||
|
||||
JobPoint jobPointRefuseCollector = new JobPoint()
|
||||
{
|
||||
Position = new Vector3(-429.237, -1727.9839, 19.73836),
|
||||
jobId = 2
|
||||
jobId = 2,
|
||||
Skill = 0
|
||||
};
|
||||
JobPoint jobPointPilot = new JobPoint()
|
||||
{
|
||||
Position = new Vector3(1707.2711181640625, 3276.216064453125, 41.155494689941406),
|
||||
jobId = 3,
|
||||
Skill = 0
|
||||
};
|
||||
JobPoint jobPointPilot2 = new JobPoint()
|
||||
{
|
||||
Position = new Vector3(-1622.48, -3151.58, 13),
|
||||
jobId = 3,
|
||||
Skill = 300
|
||||
};
|
||||
JobPoint jobPointBusDriver = new JobPoint()
|
||||
{
|
||||
Position = new Vector3(-535.46, -2144.97, 5.95),
|
||||
jobId = 4,
|
||||
Skill = 0
|
||||
};
|
||||
|
||||
jobPoints.Add(jobPointRefuseCollector);
|
||||
JobPoints.Add(jobPointRefuseCollector);
|
||||
JobPoints.Add(jobPointPilot);
|
||||
JobPoints.Add(jobPointBusDriver);
|
||||
|
||||
foreach(JobPoint p in jobPoints)
|
||||
foreach (JobPoint p in JobPoints)
|
||||
{
|
||||
NAPI.Marker.CreateMarker(1, new Vector3(p.Position.X, p.Position.Y, p.Position.Z - 2), new Vector3(p.Position.X, p.Position.Y, p.Position.Z + 1),
|
||||
new Vector3(0, 0, 0), 1.5f, new Color(255, 255, 255, 50), false, 0);
|
||||
NAPI.TextLabel.CreateTextLabel("M\u00fcllmann - Dr\u00fccke ~y~J~s~ um Job zu starten", p.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
NAPI.Blip.CreateBlip(318, p.Position, 1f, 0, "Müllmann", 255, 0,true);
|
||||
if (p.jobId == 2)
|
||||
{
|
||||
NAPI.TextLabel.CreateTextLabel("M\u00fcllmann - Dr\u00fccke ~y~E~s~ um Job zu starten", p.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
NAPI.Blip.CreateBlip(318, p.Position, 1f, 16, "Müllmann", 255, 0, true);
|
||||
}
|
||||
if (p.jobId == 3)
|
||||
{
|
||||
if (p.Skill < 2)
|
||||
{
|
||||
NAPI.TextLabel.CreateTextLabel("Pilot Anf\u00E4nger - Dr\u00fccke ~y~E~s~ um Job zu starten", p.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
NAPI.Blip.CreateBlip(251, p.Position, 1f, 16, "Pilot Anfänger", 255, 0, true);
|
||||
}
|
||||
if (p.Skill >= 2)
|
||||
{
|
||||
NAPI.TextLabel.CreateTextLabel("Pilot Fortgeschritten - Dr\u00fccke ~y~E~s~ um Job zu starten", p.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
NAPI.Blip.CreateBlip(251, p.Position, 1f, 16, "Pilot Fortgeschritten", 255, 0, true);
|
||||
}
|
||||
}
|
||||
if (p.jobId == 4)
|
||||
{
|
||||
NAPI.TextLabel.CreateTextLabel("Busfahrer - Dr\u00fccke ~y~E~s~ um Job zu starten", p.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
NAPI.Blip.CreateBlip(513, p.Position, 1f, 16, "Busfahrer", 255, 0, true);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion JobPoints
|
||||
|
||||
#region Shops
|
||||
foreach (var shop in ShopManager.clotheStores)
|
||||
{
|
||||
@@ -251,6 +296,7 @@ public class JobPoint
|
||||
{
|
||||
public Vector3 Position { get; set; }
|
||||
public int jobId { get; set; }
|
||||
public int Skill { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user