[+] Add Driving License to Interaction Menu and as 'Object' to show other Players via the Interaction menu
This commit is contained in:
34
ReallifeGamemode.Client/Gui/licenses.ts
Normal file
34
ReallifeGamemode.Client/Gui/licenses.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { isNull } from "util";
|
||||
|
||||
|
||||
export default function licenses(globalData: GlobalData): void {
|
||||
|
||||
var licenseBrowser: BrowserMp = null;
|
||||
var licenseTimer;
|
||||
var globalName;
|
||||
var globalInfo;
|
||||
|
||||
mp.events.add("ShowLicenses", (name, info) => {
|
||||
if (licenseBrowser == null) {
|
||||
licenseBrowser = mp.browsers.new('package://assets/html/licenses/scheine.html');
|
||||
globalName = name;
|
||||
globalInfo = info;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add("CEF:LicenseLoaded", () => {
|
||||
licenseBrowser.execute(`add_licenses('${JSON.stringify(globalInfo)}');`);
|
||||
licenseBrowser.execute(`add_licensesholder('${JSON.stringify(globalName)}');`);
|
||||
licenseTimer = setInterval(DestroyLicenses, 7000);
|
||||
});
|
||||
|
||||
|
||||
function DestroyLicenses() {
|
||||
licenseBrowser.destroy()
|
||||
licenseBrowser = null;
|
||||
clearInterval(licenseTimer);
|
||||
mp.events.callRemote("CLIENT:InteractionMenu_EndShow");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user