From d939b9590b4da7ca4c941e1088d126a78545eee0 Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sat, 3 Apr 2021 21:58:02 +0200 Subject: [PATCH] Add Admin Noclip , add /skill and fix heal :^) --- ReallifeGamemode.Client/Player/freecam.ts | 2 +- ReallifeGamemode.Client/Player/keys.ts | 6 ++++++ ReallifeGamemode.Client/index.ts | 4 ++-- ReallifeGamemode.Server/Commands/AdminCommands.cs | 11 +++++++++++ ReallifeGamemode.Server/Commands/FactionCommands.cs | 6 ++++++ ReallifeGamemode.Server/Commands/UserCommands.cs | 11 +++++++++++ 6 files changed, 37 insertions(+), 3 deletions(-) diff --git a/ReallifeGamemode.Client/Player/freecam.ts b/ReallifeGamemode.Client/Player/freecam.ts index d17f4928..2dbe1fbe 100644 --- a/ReallifeGamemode.Client/Player/freecam.ts +++ b/ReallifeGamemode.Client/Player/freecam.ts @@ -30,7 +30,7 @@ var shiftModifier = false; var controlModifier = false; var localPlayer = mp.players.local; - mp.keys.bind(bindVirtualKeys.F2, true, function () { + mp.events.add('ADMIN:NoClip', () => { isNoClip = !isNoClip; mp.game.ui.displayRadar(!isNoClip); if (isNoClip) { diff --git a/ReallifeGamemode.Client/Player/keys.ts b/ReallifeGamemode.Client/Player/keys.ts index 3a03bfb6..8f2e3751 100644 --- a/ReallifeGamemode.Client/Player/keys.ts +++ b/ReallifeGamemode.Client/Player/keys.ts @@ -143,4 +143,10 @@ export default function keys(globalData: IGlobalData) { mp.keys.bind(0x7A, false, () => { mp.gui.takeScreenshot(new Date().toLocaleDateString(), 1, 100, 80); }); + + //F2 //Noclip + mp.keys.bind(0x71, false, () => { + mp.events.callRemote("Noclip"); + + }); } \ No newline at end of file diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index 50417acd..848bcd2f 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -141,8 +141,8 @@ keys(globalData); import quitHandler from './Player/quit'; quitHandler(); -//import freeCam from './Player/freecam'; -//freeCam(); +import freeCam from './Player/freecam'; +freeCam(); import saveManager from './Save/main'; saveManager(); diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 1a99b053..2cfc2aa0 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -3650,5 +3650,16 @@ namespace ReallifeGamemode.Server.Commands } #endregion ALevel1338 + + [RemoteEvent("Noclip")] + public void Noclip(Player player) + { + if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true && player.HasData("Adminduty") && !player.GetData("Adminduty")) + { + return; + } + player.TriggerEvent("ADMIN:NoClip"); + } + } } diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index 6a75bf9c..6f3d2ac4 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -319,6 +319,12 @@ namespace ReallifeGamemode.Server.Commands return; } + if(player.Position.DistanceTo(target.Position) > 3) + { + ChatService.ErrorMessage(player, "Der Patient ist zu weit entfernt"); + return; + } + if (price < 10 || price > 100) { ChatService.ErrorMessage(player, "Der Preis muss zwischen 10$ und 100$ liegen"); diff --git a/ReallifeGamemode.Server/Commands/UserCommands.cs b/ReallifeGamemode.Server/Commands/UserCommands.cs index 91dabc04..00412237 100644 --- a/ReallifeGamemode.Server/Commands/UserCommands.cs +++ b/ReallifeGamemode.Server/Commands/UserCommands.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Finance; using ReallifeGamemode.Server.Managers; @@ -15,6 +16,16 @@ namespace ReallifeGamemode.Server.Commands { internal class UserCommands : Script { + + [Command("skill")] + public void CmdUserSkill(Player player) + { + User user = player.GetUser(new DatabaseContext()); + + player.SendChatMessage($"~c~BusSkill = {user.BusSkill}/800, PilotSkill = {user.PilotSkill}/300."); + + } + [Command("id", "~m~Benutzung: ~s~/id [Name]")] public void CmdUserId(Player player, String targetname) {