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
|
//Make doors breakable again
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
for (x = 0; x < 8; x++) {
|
for (x = 0; x < 8; x++) {
|
||||||
|
if (entity) {
|
||||||
entity.setDoorBreakable(x, true);
|
entity.setDoorBreakable(x, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, 1500);
|
}, 1500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
}
|
}
|
||||||
|
|
||||||
JobBase job = JobManager.GetJob(player.GetUser().JobId ?? -1);
|
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())
|
using (var saveUser = new DatabaseContext())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace ReallifeGamemode.Server.Job
|
|||||||
|
|
||||||
public void StartJob(Client player)
|
public void StartJob(Client player)
|
||||||
{
|
{
|
||||||
|
if (_inJob.Contains(player)) return;
|
||||||
_inJob.Add(player);
|
_inJob.Add(player);
|
||||||
|
|
||||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ gestartet.");
|
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);
|
JobStart?.Invoke(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StopJob(Client player)
|
public void StopJob(Client player, bool quit = false)
|
||||||
{
|
{
|
||||||
|
if (!_inJob.Contains(player)) return;
|
||||||
_inJob.Remove(player);
|
_inJob.Remove(player);
|
||||||
|
|
||||||
|
if (quit)
|
||||||
|
{
|
||||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ beendet.");
|
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ beendet.");
|
||||||
|
}
|
||||||
|
|
||||||
JobStop?.Invoke(player);
|
JobStop?.Invoke(player);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user