Nicht als Beifahrer + Nicht an aus an aus

This commit is contained in:
Mac_Slash
2020-04-28 20:32:38 +02:00
parent 5de5864c0f
commit 9ac064a5ea
2 changed files with 88 additions and 58 deletions

View File

@@ -6,6 +6,8 @@ using Newtonsoft.Json;
using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Database.Models; using ReallifeGamemode.Database.Models;
using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Syntax;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Managers;
namespace ReallifeGamemode.Server.Job namespace ReallifeGamemode.Server.Job
{ {
@@ -131,6 +133,8 @@ namespace ReallifeGamemode.Server.Job
[RemoteEvent("startBusRoute")] [RemoteEvent("startBusRoute")]
public void StartBusRoute(Player player, string type) public void StartBusRoute(Player player, string type)
{
if (player.VehicleSeat == 0)
{ {
if (type == "Kurz 1") if (type == "Kurz 1")
{ {
@@ -152,12 +156,14 @@ namespace ReallifeGamemode.Server.Job
{ {
CheckPointHandle.StartCheckPointRoute(player, RouteVeryLong, 3000, 1, 7, 5, "busDriverJob"); CheckPointHandle.StartCheckPointRoute(player, RouteVeryLong, 3000, 1, 7, 5, "busDriverJob");
} }
}
} }
public static void payWage(Player jobber, int wage) public static void payWage(Player jobber, int wage)
{ {
using (var dbContext = new DatabaseContext()) using (var dbContext = new DatabaseContext())
{
if (jobber.VehicleSeat == 0)
{ {
jobber.GetUser(dbContext).BankAccount.Balance += wage; jobber.GetUser(dbContext).BankAccount.Balance += wage;
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast ~g~${wage} ~w~bekommen."); jobber.SendChatMessage($"~y~[JOB] ~w~Du hast ~g~${wage} ~w~bekommen.");
@@ -173,6 +179,14 @@ namespace ReallifeGamemode.Server.Job
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast nun ~g~Skill-Level 3 ~w~erreicht!"); jobber.SendChatMessage($"~y~[JOB] ~w~Du hast nun ~g~Skill-Level 3 ~w~erreicht!");
jobber.SendChatMessage($"~y~[JOB] ~w~Du kannst jetzt mit dem Coach, und dem Tourbus fahren!"); jobber.SendChatMessage($"~y~[JOB] ~w~Du kannst jetzt mit dem Coach, und dem Tourbus fahren!");
} }
}
else
{
JobBase job = JobManager.GetJob(jobber.GetUser().JobId.Value);
job.StopJob(jobber);
CheckPointHandle.DeleteCheckpoints(jobber);
ChatService.SendMessage(jobber, $"~y~[JOB]~s~ Du hast deinen Job ~o~{job.Name}~s~ beendet.");
}
//BusLetzterCheckpoint(jobber); //BusLetzterCheckpoint(jobber);
//BusDriverJob rt = null; //BusDriverJob rt = null;
//rt.BusLetzterCheckpoint() //rt.BusLetzterCheckpoint()

View File

@@ -5,6 +5,9 @@ using ReallifeGamemode.Server.Util;
using Newtonsoft.Json; using Newtonsoft.Json;
using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Database.Models; using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Managers;
namespace ReallifeGamemode.Server.Job namespace ReallifeGamemode.Server.Job
{ {
class PilotJob : JobBase class PilotJob : JobBase
@@ -138,6 +141,8 @@ namespace ReallifeGamemode.Server.Job
} }
[RemoteEvent("startPilotRoute")] [RemoteEvent("startPilotRoute")]
public void StartPilotRoute(Player player, string type) public void StartPilotRoute(Player player, string type)
{
if (player.VehicleSeat == 0)
{ {
if (type == "Route 1") if (type == "Route 1")
{ {
@@ -164,9 +169,12 @@ namespace ReallifeGamemode.Server.Job
CheckPointHandle.StartCheckPointRoute(player, Route6, 0, 6, 40, 40, "pilotJob"); CheckPointHandle.StartCheckPointRoute(player, Route6, 0, 6, 40, 40, "pilotJob");
} }
} }
}
public static void payWage(Player jobber, int wage) public static void payWage(Player jobber, int wage)
{ {
using (var dbContext = new DatabaseContext()) using (var dbContext = new DatabaseContext())
{
if (jobber.VehicleSeat == 0)
{ {
jobber.GetUser(dbContext).BankAccount.Balance += wage; jobber.GetUser(dbContext).BankAccount.Balance += wage;
jobber.SendChatMessage($"~y~[JOB] ~w~Du hast ~g~${wage} ~w~bekommen."); jobber.SendChatMessage($"~y~[JOB] ~w~Du hast ~g~${wage} ~w~bekommen.");
@@ -178,6 +186,14 @@ namespace ReallifeGamemode.Server.Job
jobber.SendChatMessage($"~y~[JOB] ~w~Du kannst jetzt auch mit dem Velum Flugzeug (LS Airport) fliegen!"); jobber.SendChatMessage($"~y~[JOB] ~w~Du kannst jetzt auch mit dem Velum Flugzeug (LS Airport) fliegen!");
} }
} }
else
{
JobBase job = JobManager.GetJob(jobber.GetUser().JobId.Value);
job.StopJob(jobber);
CheckPointHandle.DeleteCheckpoints(jobber);
ChatService.SendMessage(jobber, $"~y~[JOB]~s~ Du hast deinen Job ~o~{job.Name}~s~ beendet.");
}
}
} }
[RemoteEvent("PilotLetzterCheckpoint")] [RemoteEvent("PilotLetzterCheckpoint")]
public static void PilotLetzterCheckpoint(Player player) public static void PilotLetzterCheckpoint(Player player)