diff --git a/Client/Player/quit.js b/Client/Player/quit.js new file mode 100644 index 00000000..032cfa8a --- /dev/null +++ b/Client/Player/quit.js @@ -0,0 +1,9 @@ +/** + * @overview Life of German Reallife - Player Quit quit.js + * @author hydrant + * @copyright (c) 2008 - 2018 Life of German + */ + +mp.events.add('playerQuit', (player, exitType, reason) => { + mp.game.ui.clearHelp(true); +}); \ No newline at end of file diff --git a/Client/Tuning/main.js b/Client/Tuning/main.js new file mode 100644 index 00000000..a5b549ae --- /dev/null +++ b/Client/Tuning/main.js @@ -0,0 +1,15 @@ +/** + * @overview Life of German Reallife - Tuning tuning.js + * @author hydrant + * @copyright (c) 2008 - 2018 Life of German + */ + +mp.events.add('showTuningInfo', () => { + mp.game.ui.setTextComponentFormat('STRING'); + mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um dein Fahrzeug zu modifizieren'); + mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1); +}); + +mp.events.add('hideTuningInfo', () => { + mp.game.ui.clearHelp(true); +}); \ No newline at end of file diff --git a/Client/index.js b/Client/index.js index a6204744..7e020506 100644 --- a/Client/index.js +++ b/Client/index.js @@ -17,3 +17,4 @@ require('./Player/waypoint.js'); require('./FactionManagement/main.js'); +require('./Tuning/main.js'); \ No newline at end of file diff --git a/Main.cs b/Main.cs index 54defe8b..3d303721 100644 --- a/Main.cs +++ b/Main.cs @@ -4,6 +4,7 @@ using GTANetworkAPI; using Microsoft.EntityFrameworkCore; using reallife_gamemode.Model; using reallife_gamemode.Server.Entities; +using reallife_gamemode.Server.Managers; /** * @overview Life of German Reallife - Main Class (Main.cs) @@ -25,6 +26,8 @@ namespace reallife_gamemode NAPI.Server.SetDefaultSpawnLocation(DEFAULT_SPAWN_POSITION, DEFAULT_SPAWN_HEADING); NAPI.Server.SetAutoSpawnOnConnect(false); + TuningManager.AddTuningGarage(new Vector3(-341, -134, 38.5), new Vector3(-334, -143, 41)); + using (var context = new DatabaseContext()) { context.Bans.FirstOrDefault(); @@ -34,5 +37,8 @@ namespace reallife_gamemode context.SaveChanges(); } } + + [Command("dim")] + public void dim(Client player) => player.SendChatMessage(player.Dimension.ToString()); } } \ No newline at end of file diff --git a/Server/Managers/TuningManager.cs b/Server/Managers/TuningManager.cs new file mode 100644 index 00000000..7860e2ed --- /dev/null +++ b/Server/Managers/TuningManager.cs @@ -0,0 +1,41 @@ +using GTANetworkAPI; +using reallife_gamemode.Server.Util; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace reallife_gamemode.Server.Managers +{ + class TuningManager : Script + { + private static List tuningGarages = new List(); + + public static void AddTuningGarage(Vector3 pos1, Vector3 pos2) + { + // DEBUG + + NAPI.TextLabel.CreateTextLabel("Pos1", pos1, 100, 1, 0, new Color(255, 255, 255), true, 0); + NAPI.TextLabel.CreateTextLabel("Pos2", pos2, 100, 1, 0, new Color(255, 255, 255), true, 0); + + ColShape colShape = NAPI.ColShape.CreateSphereColShape(pos1, 10, 0); + + colShape.OnEntityEnterColShape += ColShape_OnEntityEnterColShape; + colShape.OnEntityExitColShape += ColShape_OnEntityExitColShape; + + tuningGarages.Add(colShape); + } + + private static void ColShape_OnEntityExitColShape(ColShape colShape, Client client) + { + NAPI.Util.ConsoleOutput("exit colshape"); + client.TriggerEvent("hideTuningInfo"); + } + + private static void ColShape_OnEntityEnterColShape(ColShape colShape, Client client) + { + NAPI.Util.ConsoleOutput("enter colshape"); + client.TriggerEvent("showTuningInfo"); + } + } +}