add job menu and start job

This commit is contained in:
hydrant
2019-05-16 18:35:43 +02:00
parent 5b014d6668
commit 2fb1f198cf
10 changed files with 117 additions and 12 deletions

View File

@@ -96,5 +96,35 @@ namespace ReallifeGamemode.Server.Managers
dbContext.SaveChanges();
}
}
[RemoteEvent("CLIENT:JobManager_ShowJobMenu")]
public void ShowJobMenuEvent(Client player)
{
User u = player.GetUser();
if (u.JobId == null) return;
JobBase job = GetJob(u.JobId.Value);
player.TriggerEvent("SERVER:Job_ShowJobMenu", job.Name);
}
[RemoteEvent("CLIENT:Job_StartJob")]
public void StartJobEvent(Client player)
{
User u = player.GetUser();
if (u.JobId == null) return;
JobBase job = GetJob(u.JobId.Value);
if(job.GetUsersInJob().Contains(player))
{
ChatService.Error(player, "Du bist schon in deinem Job aktiv");
return;
}
job.StartJob(player);
}
}
}