fix server crash when player with job quits
This commit is contained in:
@@ -541,8 +541,10 @@ export default function vehicleSync() {
|
||||
//Make doors breakable again
|
||||
setTimeout(() => {
|
||||
for (x = 0; x < 8; x++) {
|
||||
if (entity) {
|
||||
entity.setDoorBreakable(x, true);
|
||||
}
|
||||
}
|
||||
}, 1500);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
|
||||
JobBase job = JobManager.GetJob(player.GetUser().JobId ?? -1);
|
||||
if (job != null) job.StopJob(player);
|
||||
if (job != null) job.StopJob(player, true);
|
||||
|
||||
using (var saveUser = new DatabaseContext())
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace ReallifeGamemode.Server.Job
|
||||
|
||||
public void StartJob(Client player)
|
||||
{
|
||||
if (_inJob.Contains(player)) return;
|
||||
_inJob.Add(player);
|
||||
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ gestartet.");
|
||||
@@ -36,11 +37,15 @@ namespace ReallifeGamemode.Server.Job
|
||||
JobStart?.Invoke(player);
|
||||
}
|
||||
|
||||
public void StopJob(Client player)
|
||||
public void StopJob(Client player, bool quit = false)
|
||||
{
|
||||
if (!_inJob.Contains(player)) return;
|
||||
_inJob.Remove(player);
|
||||
|
||||
if (quit)
|
||||
{
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ beendet.");
|
||||
}
|
||||
|
||||
JobStop?.Invoke(player);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user