Disable some interactions while player is in vehicle or dead.

Change keybind mapping from X to Z due to interference with game functions.
This commit is contained in:
2021-05-02 06:15:50 +02:00
parent 81c82f215a
commit 6d675018dc
2 changed files with 5 additions and 6 deletions

View File

@@ -122,10 +122,10 @@ export default function keys(globalData: IGlobalData) {
}
});
//X // Fahrzeug Verwaltung - Menü
mp.keys.bind(0x58, false, function () {
//Z // Fahrzeug Verwaltung - Menü
KeyBinder.bind(0x5A, false, function () {
if (!globalData.InChat && !globalData.InMenu && !globalData.InTuning) {
mp.events.callRemote("keyPress:X");
mp.events.callRemote("keyPress:Z");
}
});

View File

@@ -116,7 +116,7 @@ namespace ReallifeGamemode.Server.Events
[RemoteEvent("keyPress:M")]
public void KeyPressM(Player player)
{
if (!player.IsLoggedIn() || player.GetData<bool>("isDead")) return;
if (!player.IsLoggedIn()) return;
using var dbContext = new DatabaseContext();
User u = player.GetUser(dbContext);
if (u == null) return;
@@ -607,7 +607,6 @@ namespace ReallifeGamemode.Server.Events
player.TriggerEvent("inventoryShow");
InventoryManager.SetBackpackItems(player);
}
[RemoteEvent("keyPress:J")]
@@ -867,7 +866,7 @@ namespace ReallifeGamemode.Server.Events
VehicleStreaming.SetEngineState(v, !state);
}
[RemoteEvent("keyPress:X")]
[RemoteEvent("keyPress:Z")]
public void KeyPressX(Player player)
{
if (!player.IsLoggedIn() || player.GetData<bool>("isDead")) return;