Begin tuning system
This commit is contained in:
9
Client/Player/quit.js
Normal file
9
Client/Player/quit.js
Normal file
@@ -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);
|
||||
});
|
||||
15
Client/Tuning/main.js
Normal file
15
Client/Tuning/main.js
Normal file
@@ -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);
|
||||
});
|
||||
@@ -17,3 +17,4 @@ require('./Player/waypoint.js');
|
||||
|
||||
require('./FactionManagement/main.js');
|
||||
|
||||
require('./Tuning/main.js');
|
||||
6
Main.cs
6
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());
|
||||
}
|
||||
}
|
||||
41
Server/Managers/TuningManager.cs
Normal file
41
Server/Managers/TuningManager.cs
Normal file
@@ -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<ColShape> tuningGarages = new List<ColShape>();
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user