diff --git a/ReallifeGamemode.Client/Gui/blips.ts b/ReallifeGamemode.Client/Gui/blips.ts index 547b6a10..1c44de47 100644 --- a/ReallifeGamemode.Client/Gui/blips.ts +++ b/ReallifeGamemode.Client/Gui/blips.ts @@ -25,14 +25,15 @@ playerBlipMap.set(player, pBlip); } let pBlip = playerBlipMap.get(player); - let color = player.getVariable("blipColor"); - pBlip.setColour(isNaN(color) ? 0 : color); - pBlip.setPosition(player.position.x, player.position.y, player.position.z); if (player.isDead()) { pBlip.setSprite(303); } else { pBlip.setSprite(1); } + let color = player.getVariable("blipColor"); + pBlip.setColour(isNaN(color) ? 0 : color); + pBlip.setPosition(player.position.x, player.position.y, player.position.z); + }); }, 50); diff --git a/ReallifeGamemode.Client/Gui/nametags.ts b/ReallifeGamemode.Client/Gui/nametags.ts index 7fee2fc4..97fd1cc5 100644 --- a/ReallifeGamemode.Client/Gui/nametags.ts +++ b/ReallifeGamemode.Client/Gui/nametags.ts @@ -29,7 +29,7 @@ const colors = [ export default function customNametags() { mp.nametags.enabled = false; - mp.events.add('render', (nametags) => { + mp.events.add(RageEnums.EventKey.RENDER, (nametags) => { const graphics = mp.game.graphics; const screenRes = graphics.getScreenResolution(0, 0); @@ -51,7 +51,13 @@ export default function customNametags() { let color = colors.find(c => c.id === colorId).color; - mp.game.graphics.drawText(player.name + " (" + player.remoteId + ")", [x, y], + let nametagText = player.name + " (" + player.remoteId + ")"; + + if (player.getVariable("isAfk")) { + nametagText += " ~r~AFK"; + } + + mp.game.graphics.drawText(nametagText, [x, y], { font: 4, color: [color[0], color[1], color[2], color[3]], diff --git a/ReallifeGamemode.Client/Gui/policedepartment.ts b/ReallifeGamemode.Client/Gui/policedepartment.ts index df378604..4fd90f72 100644 --- a/ReallifeGamemode.Client/Gui/policedepartment.ts +++ b/ReallifeGamemode.Client/Gui/policedepartment.ts @@ -4,7 +4,7 @@ import { Menu, Point, UIMenuItem } from "../libs/NativeUI"; import { createMenuItem } from "../util"; import moneyformat from "../moneyformat"; var screenRes = mp.game.graphics.getScreenResolution(0, 0); -var menu: Menu = new Menu("Polizeirevier", "Die Hilfestelle der Polizei", new Point(0, screenRes.y / 3)); +var menu: Menu = new Menu("", "Hier kannst du den Waffenschein erwerben", new Point(0, screenRes.y / 3), "shopui_title_gunclub", "shopui_title_gunclub"); menu.AddItem(createMenuItem("Waffenschein kaufen", "Erwerbe einen Waffenschein", (item) => { item.SetRightLabel("$" + moneyformat(5000)); @@ -24,7 +24,7 @@ menu.MenuClose.on(() => { game.events.add("SERVER:PoliceDepartment_EnterColShape", () => { //game.ui.setHelpText("Drücke ~INPUT_CONTEXT~, um das Menü des Polizeireviers zu öffnen"); - mp.events.call("renderHelpTextOnScreen", "~s~Drücke ~g~E~s~ um das Menü des ~b~Polizeireviers ~s~zu öffnen") + //mp.events.call("renderHelpTextOnScreen", "~s~Drücke ~g~E~s~ um das Menü des ~b~Polizeireviers ~s~zu öffnen") game.events.bindKey(Key.E, false, keyPressHandler); }); diff --git a/ReallifeGamemode.Client/Gui/vehiclemenu/main.ts b/ReallifeGamemode.Client/Gui/vehiclemenu/main.ts index d5988b50..385eaacb 100644 --- a/ReallifeGamemode.Client/Gui/vehiclemenu/main.ts +++ b/ReallifeGamemode.Client/Gui/vehiclemenu/main.ts @@ -9,6 +9,44 @@ var screenRes = mp.game.graphics.getScreenResolution(0, 0); export default function vehicleMenu(globalData: IGlobalData) { let menuBrowser: BrowserMp = null; + var lastDriversBrowser: BrowserMp = null; + + var lastDrivers = null; + + mp.events.add('lookLastDrivers', (lastDriversParam) => { + lastDrivers = JSON.parse(lastDriversParam); + + if (lastDriversBrowser !== null) { + lastDriversBrowser.destroy(); + lastDriversBrowser = null; + globalData.InMenu = false; + mp.gui.cursor.show(false, false); + mp.gui.chat.activate(true); + } + else if (!globalData.InMenu) { + globalData.InMenu = true; + lastDriversBrowser = mp.browsers.new('package://assets/vehicle/lastPlayers.html'); + mp.gui.chat.activate(false); + mp.gui.cursor.show(true, true); + } + }); + + mp.events.add("CEF:VehicleLook_Loaded", () => { + lastDriversBrowser.execute(`setDrivers('${JSON.stringify(lastDrivers)}');`); + }); + + mp.events.add("removeLookMenu", () => { + if (lastDriversBrowser == null) { + return; + } + else if (globalData.InMenu) { + lastDriversBrowser.destroy(); + lastDriversBrowser = null; + globalData.InMenu = false; + mp.gui.cursor.show(false, false); + mp.gui.chat.activate(true); + } + }); mp.events.add('ToggleVehicleMenu', () => { if (menuBrowser !== null) { diff --git a/ReallifeGamemode.Client/Interaction/ammunation/ammunation.ts b/ReallifeGamemode.Client/Interaction/ammunation/ammunation.ts new file mode 100644 index 00000000..947c7797 --- /dev/null +++ b/ReallifeGamemode.Client/Interaction/ammunation/ammunation.ts @@ -0,0 +1,89 @@ +import * as NativeUI from '../../libs/NativeUI'; + +const Menu = NativeUI.Menu; +const MenuItem = NativeUI.UIMenuItem; +const MenuListItem = NativeUI.UIMenuListItem; +const MenuCheckboxItem = NativeUI.UIMenuCheckboxItem; +const BadgeStyle = NativeUI.BadgeStyle; +const Point = NativeUI.Point; +const ItemsCollection = NativeUI.ItemsCollection; +const Color = NativeUI.Color; + +export default function ammunation(globalData: IGlobalData) { + + var screenRes = mp.game.graphics.getScreenResolution(0, 0); + var weapons: Weapon[]; + + mp.events.add("AmmunationShop:LoadNativeUI", (weaponList: string) => { + + weapons = JSON.parse(weaponList); + var menu = getAmmunationMenu(); + + //Schaut nach ob mindestens eine Waffe in weapons existiert welche die CategoryId beinhaltet + for (var c = 1; c < 10; c++) { + switch (c) { + case 1: { //Meelee + + break; + } + + case 2: { //Pistolen + if (weapons.find(w => w.CategoryId == c)) { + var pistolItem = new MenuItem("Pistolen", "Das kleine Kaliber",); + menu.AddItem(pistolItem); + menu.BindMenuToItem(getWeaponsFromCategory(menu, c, "Pistolen"),pistolItem); + } + break; + } + /*case 9: { //Sonstiges (Armor / Fallschirm) + var otherItem = new MenuItem("Sonstiges", "Schutzwesten, Fallschirme...",); + menu.AddItem(otherItem); + menu.BindMenuToItem(getWeaponsFromCategory(menu, c, "Sonstiges"), otherItem); + break; + }*/ + } + } + menu.Open(); + mp.gui.chat.activate(false); + globalData.InMenu = true; + + menu.MenuClose.on(() => { + globalData.InMenu = false; + mp.gui.chat.show(true); + }) + }); + + function getAmmunationMenu(): NativeUI.Menu { + return new Menu("", "AMMU NATION - Waffenladen", new Point(0, screenRes.y / 3), "shopui_title_gunclub", "shopui_title_gunclub"); + } + + function getWeaponsFromCategory(parentMenu: NativeUI.Menu, category: number, categoryName: string): NativeUI.Menu { + var categoryMenu = new Menu("", categoryName, new Point(0, screenRes.y / 3), "shopui_title_gunclub", "shopui_title_gunclub"); + + categoryMenu.Visible = false; + + var cWeapons: Weapon[] = weapons.filter(w => w.CategoryId == category); + + if (category < 9) { //Weapons aus Datenbank + cWeapons.forEach(weapon => { + var weaponItem: NativeUI.UIMenuItem = new MenuItem(weapon.WeaponModel, "Du erhältst " + weapon.Ammo + " Munition", [weapon.WeaponModel, weapon.Ammo, weapon.Price]); + categoryMenu.AddItem(weaponItem); + weaponItem.SetRightLabel("~g~$" + weapon.Price.toString()); + }) + } else { //Sonstiges = Schutzwesten / Fallschirme + var armorItem = new MenuItem("Schutzweste", "Sch\u00fctzt dich","armor",); + categoryMenu.AddItem(armorItem); + armorItem.SetRightLabel("~g~$3000"); + + var parachuteItem = new MenuItem("Fallschirm", "Flieg damit wohin du willst"); + categoryMenu.AddItem(parachuteItem); + parachuteItem.SetRightLabel("~g~$500"); + } + + categoryMenu.ItemSelect.on((item: NativeUI.UIMenuItem, index: number) => { + mp.events.callRemote("CLIENT:Ammunation_BuyWeapon", item.Data[0], item.Data[1], item.Data[2]); //weaponmodel / ammo / price + }); + + return categoryMenu; + }; +}; \ No newline at end of file diff --git a/ReallifeGamemode.Client/Interaction/interactionmenu.ts b/ReallifeGamemode.Client/Interaction/interactionmenu.ts index 3864a46d..0eb1b053 100644 --- a/ReallifeGamemode.Client/Interaction/interactionmenu.ts +++ b/ReallifeGamemode.Client/Interaction/interactionmenu.ts @@ -464,6 +464,23 @@ export default function (globalData: IGlobalData) { wageItem.SetRightLabel("$" + jobdata.wage.toString()) } jobMenu.AddItem(wageItem); + + if (jobdata.isActive) { + var quitJobItem = new UIMenuItem("Job Beenden", "Beendet den Job und bringt dich zurück zur Base") + jobMenu.AddItem(quitJobItem); + quitJobItem.HighlightedBackColor = new Color(213, 0, 0); + quitJobItem.BackColor = new Color(229, 57, 53); + + jobMenu.ItemSelect.on((item, index) => { + if (item == quitJobItem) { + mp.events.callRemote("CLIENT:Job_StopJob"); + jobMenu.Close(true); + mp.gui.chat.activate(true); + globalData.InMenu = false; + } + }); + } + jobMenu.Visible = false; mp.gui.chat.show(false); return jobMenu; diff --git a/ReallifeGamemode.Client/admin/spectate.ts b/ReallifeGamemode.Client/admin/spectate.ts new file mode 100644 index 00000000..cf66bb43 --- /dev/null +++ b/ReallifeGamemode.Client/admin/spectate.ts @@ -0,0 +1,12 @@ +let cam: CameraMp = mp.cameras.new('spectateCam');; +mp.events.add("SERVER:ADMIN_SPECTATE", (targetPlayer) => { + cam.attachTo(targetPlayer.handle, 10.0, 0.0, 10.0, true); + cam.setActive(true); +}); + +mp.events.add("SERVER:ADMIN_STOP_SPECTATE", () => { + if (cam.isActive() == true) { + cam.setActive(false); + } +}); + \ No newline at end of file diff --git a/ReallifeGamemode.Client/assets/chat/index.html b/ReallifeGamemode.Client/assets/chat/index.html index 235d45c3..d4354663 100644 --- a/ReallifeGamemode.Client/assets/chat/index.html +++ b/ReallifeGamemode.Client/assets/chat/index.html @@ -9,6 +9,6 @@