Erweiterung für Busfahrer, CheckpointSystem, PilotJob, Skillsystem, AdminBefehle
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
@@ -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<bool>("duty")));
|
||||
ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.6 && (user.FactionId == 1 || user.FactionId == 3));
|
||||
ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && (!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);
|
||||
ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6);
|
||||
JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6);
|
||||
|
||||
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<bool>("duty"));
|
||||
DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.6 && d.FactionId == user.FactionId);
|
||||
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.6 && w.FactionId == user.FactionId);
|
||||
JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.6 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData<bool>("duty"));
|
||||
|
||||
|
||||
if (nearestDuty != null)// Duty Point
|
||||
@@ -376,6 +376,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
if (nearestJobPoint != null)
|
||||
{
|
||||
if (player.Vehicle != null) return;
|
||||
Job.JobBase job = JobManager.GetJob(player.GetUser().JobId.Value);
|
||||
JobManager jobb = new JobManager();
|
||||
if (nearestJobPoint.jobId != 3 && nearestJobPoint.jobId == player.GetUser().JobId)
|
||||
@@ -393,33 +394,33 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
if (nearestJobPoint.jobId == 3 && player.GetUser().JobId == 3)
|
||||
{
|
||||
if (nearestJobPoint.Skill == 0 && player.GetUser().PilotSkill < 300)
|
||||
if (nearestJobPoint.Skill < 300 && player.GetUser().PilotSkill >= 0)
|
||||
{
|
||||
if (job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
user.SetData("PilotenBase", 1);
|
||||
jobb.StopJob(player);
|
||||
user.SetData("PilotenBase2", false);
|
||||
return;
|
||||
}
|
||||
if (!job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
user.SetData("PilotenBase", 1);
|
||||
jobb.StartJobEvent(player);
|
||||
user.SetData("PilotenBase2", false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (nearestJobPoint.Skill == 300 && player.GetUser().PilotSkill >= 300)
|
||||
if (nearestJobPoint.Skill >= 300 && player.GetUser().PilotSkill >= 300)
|
||||
{
|
||||
if (job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
user.SetData("PilotenBase", 2);
|
||||
jobb.StopJob(player);
|
||||
user.SetData("PilotenBase2", false);
|
||||
return;
|
||||
}
|
||||
if (!job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
user.SetData("PilotenBase", 2);
|
||||
jobb.StartJobEvent(player);
|
||||
user.SetData("PilotenBase2", true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -543,10 +544,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
else if (sV is FactionVehicle fV)
|
||||
{
|
||||
if (u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty())
|
||||
{
|
||||
}
|
||||
else if (!fV.GetOwners().Contains(u.FactionId ?? 0) && !state && !(u.IsAdmin(AdminLevel.HEADADMIN)))
|
||||
if (!fV.GetOwners().Contains(u.FactionId ?? 0) && !state && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()))
|
||||
{
|
||||
player.SendNotification("~r~Du hast keinen Schlüssel.");
|
||||
return;
|
||||
@@ -554,10 +552,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
else if (sV is GroupVehicle gV)
|
||||
{
|
||||
if (u.IsAdmin(AdminLevel.ADMIN3) && player.IsAdminDuty())
|
||||
{
|
||||
}
|
||||
else if (gV.GroupId != u.Group.Id && !state && !u.IsAdmin(AdminLevel.ADMIN3))
|
||||
if (gV.GroupId != u.Group.Id && !state && !u.IsAdmin(AdminLevel.ADMIN3) && player.IsAdminDuty())
|
||||
{
|
||||
player.SendNotification("~r~Du hast keinen Schlüssel.");
|
||||
return;
|
||||
@@ -565,7 +560,12 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
else if (sV is JobVehicle jV)
|
||||
{
|
||||
if (jV.JobId == player.GetUser().JobId)
|
||||
if (jV.JobId != player.GetUser().JobId && !state && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()))
|
||||
{
|
||||
player.SendNotification("~r~Du hast keinen Schlüssel.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!jV.GetJob().GetUsersInJob().Contains(player))
|
||||
{
|
||||
@@ -574,36 +574,80 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((VehicleHash)jV.Model == VehicleHash.Bus)
|
||||
if (jV.JobId == 3)
|
||||
{
|
||||
player.TriggerEvent("CLIENT:SetDoorOpen", 0, false, false);
|
||||
player.TriggerEvent("CLIENT:SetDoorOpen", 1, false, false);
|
||||
player.TriggerEvent("CLIENT:SetDoorOpen", 2, false, false);
|
||||
player.TriggerEvent("CLIENT:SetDoorOpen", 3, false, false);
|
||||
player.TriggerEvent("CLIENT:SetDoorShut", 0, false);
|
||||
player.TriggerEvent("CLIENT:SetDoorShut", 1, false);
|
||||
player.TriggerEvent("CLIENT:SetDoorShut", 2, false);
|
||||
player.TriggerEvent("CLIENT:SetDoorShut", 3, false);
|
||||
Job.PilotJob c = new Job.PilotJob();
|
||||
if ((VehicleHash)jV.Model == VehicleHash.Cuban800 && !state)
|
||||
{
|
||||
if (!player.HasData("HatRoute") || player.GetData<bool>("HatRoute") == false)
|
||||
{
|
||||
player.SetData("HatRoute", true);
|
||||
c.StartPilotRoute(player, "RouteStart");
|
||||
}
|
||||
}
|
||||
if ((VehicleHash)jV.Model == VehicleHash.Velum && !state || (VehicleHash)jV.Model == VehicleHash.Velum2 && !state)
|
||||
{
|
||||
if (player.GetUser().PilotSkill >= 300)
|
||||
{
|
||||
if (!player.HasData("HatRoute") || player.GetData<bool>("HatRoute") == false)
|
||||
{
|
||||
player.SetData("HatRoute", true);
|
||||
c.StartPilotRoute(player, "RouteStart");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendNotification("~y~[JOB] ~r~Du besitzt nicht das nötige Skilllevel(2) ");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((VehicleHash)jV.Model == VehicleHash.Coach)
|
||||
if (jV.JobId == 4)
|
||||
{
|
||||
player.TriggerEvent("CLIENT:SetDoorOpen", 0, false, false);
|
||||
player.TriggerEvent("CLIENT:SetDoorShut", 0, false);
|
||||
}
|
||||
if ((VehicleHash)jV.Model == VehicleHash.Tourbus)
|
||||
{
|
||||
player.TriggerEvent("CLIENT:SetDoorOpen", 2, false, false);
|
||||
player.TriggerEvent("CLIENT:SetDoorOpen", 3, false, false);
|
||||
player.TriggerEvent("CLIENT:SetDoorShut", 2, false);
|
||||
player.TriggerEvent("CLIENT:SetDoorShut", 3, false);
|
||||
Job.BusDriverJob c = new Job.BusDriverJob();
|
||||
if ((VehicleHash)jV.Model == VehicleHash.Bus && !state)
|
||||
{
|
||||
if (!player.HasData("HatRoute") || player.GetData<bool>("HatRoute") == false)
|
||||
{
|
||||
player.SetData("HatRoute", true);
|
||||
c.StartBusRoute(player, "RouteStart");
|
||||
}
|
||||
}
|
||||
if ((VehicleHash)jV.Model == VehicleHash.Coach && !state)
|
||||
{
|
||||
if (player.GetUser().BusSkill >= 300)
|
||||
{
|
||||
if (!player.HasData("HatRoute") || player.GetData<bool>("HatRoute") == false)
|
||||
{
|
||||
player.SetData("HatRoute", true);
|
||||
c.StartBusRoute(player, "RouteStart");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendNotification("~y~[JOB] ~r~Du besitzt nicht das nötige Skilllevel(2) ");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((VehicleHash)jV.Model == VehicleHash.Tourbus && !state)
|
||||
{
|
||||
if (player.GetUser().BusSkill >= 800)
|
||||
{
|
||||
if (!player.HasData("HatRoute") || player.GetData<bool>("HatRoute") == false)
|
||||
{
|
||||
player.SetData("HatRoute", true);
|
||||
c.StartBusRoute(player, "RouteStart");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendNotification("~y~[JOB] ~r~Du besitzt nicht das nötige Skilllevel(3) ");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendNotification("~r~Du hast keinen Schlüssel.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (sV is UserVehicle uV)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user