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

@@ -0,0 +1,25 @@
import * as NativeUI from 'NativeUI';
export default function (globalData: GlobalData) {
mp.events.add("SERVER:Job_ShowJobMenu", (jobName: string) => {
if (globalData.InMenu) return;
var menu = new NativeUI.Menu("Job", jobName, new NativeUI.Point(50, 50), null, null);
menu.AddItem(new NativeUI.UIMenuItem("Job starten"));
globalData.InMenu = true;
menu.ItemSelect.on((item: NativeUI.UIMenuItem, index: number) => {
if (index === 0) { // Job starten
mp.events.callRemote("CLIENT:Job_StartJob");
}
menu.Close();
});
menu.MenuClose.on(() => {
globalData.InMenu = false;
})
});
}