/setjob nur existierende jobs

This commit is contained in:
hydrant
2020-05-07 19:53:33 +02:00
parent 1f9027c1cd
commit b04ad523f6
2 changed files with 7 additions and 2 deletions

View File

@@ -1005,9 +1005,9 @@ namespace ReallifeGamemode.Server.Commands
ChatService.PlayerNotFound(player); ChatService.PlayerNotFound(player);
return; return;
} }
if (JobID < 0) if (JobManager.GetJob(JobID) == null)
{ {
ChatService.SendMessage(player, "~r~JobID kann nicht unter 0 sein"); ChatService.ErrorMessage(player, "Dieser job existiert nicht");
return; return;
} }
using (var dbContext = new DatabaseContext()) using (var dbContext = new DatabaseContext())

View File

@@ -32,6 +32,11 @@ namespace ReallifeGamemode.Server.Services
public static void ErrorMessage(Player player, string message) public static void ErrorMessage(Player player, string message)
{ {
if (message.EndsWith("."))
{
message.Substring(0, message.Length - 1);
}
ChatService.SendMessage(player, $"~r~[FEHLER]~s~ {message}~s~."); ChatService.SendMessage(player, $"~r~[FEHLER]~s~ {message}~s~.");
} }