add job menu and start job
This commit is contained in:
25
ReallifeGamemode.Client/Jobs/main.ts
Normal file
25
ReallifeGamemode.Client/Jobs/main.ts
Normal 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;
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user