From c52f04026f9ec36b796f2b9aa7050336d46ce241 Mon Sep 17 00:00:00 2001 From: "michael.reiswich" Date: Fri, 2 Jul 2021 16:52:24 +0200 Subject: [PATCH] =?UTF-8?q?corvex=20letzte=20=C3=A4nderung=20hinzugef?= =?UTF-8?q?=C3=BCgt=20&=20luke=20dimension=20gefixt=20&=20add=20Waffen=20P?= =?UTF-8?q?ickups=20muss=20man=20testen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../util/vVehicleDamage.ts | 7 +++- ReallifeGamemode.Client/util/weapondamage.ts | 24 +++++++++++ .../Commands/AdminCommands.cs | 40 ++++++++++++++++++- 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/ReallifeGamemode.Client/util/vVehicleDamage.ts b/ReallifeGamemode.Client/util/vVehicleDamage.ts index dd118ac7..2acf3e7d 100644 --- a/ReallifeGamemode.Client/util/vVehicleDamage.ts +++ b/ReallifeGamemode.Client/util/vVehicleDamage.ts @@ -19,6 +19,11 @@ export class vVehicleDamage try { + if(veh.getPedInSeat(-1) == 0) + veh.setInvincible(true); + else + veh.setInvincible(false); + if(veh.getEngineHealth() < 0 || veh.getHealth() <= 250) { veh.setEngineHealth(0); @@ -40,4 +45,4 @@ export class vVehicleDamage } } -const PetrolDamage = new vVehicleDamage(); \ No newline at end of file +const PetrolDamage = new vVehicleDamage(); diff --git a/ReallifeGamemode.Client/util/weapondamage.ts b/ReallifeGamemode.Client/util/weapondamage.ts index d44a335b..2b4c1f3d 100644 --- a/ReallifeGamemode.Client/util/weapondamage.ts +++ b/ReallifeGamemode.Client/util/weapondamage.ts @@ -170,6 +170,30 @@ export default function weapondamageUtil(globalData: IGlobalData) { } }); + mp.events.add("ADMIN:test", (weapon, pickuphash, weaponhash, ammo, x, y, z, ) => { + mp.gui.chat.push("angekommen"); + //mp.game.object.createPickupRotate(0xE46E11B4, 100, 100 + 3, 80, 0, 0, 0, 512, 10, 0, true, 1834241177); + + + let pickup = mp.game.object.createPickupRotate(pickuphash, x + 2, y, z, 0, 0, 0, 512, ammo, 0, true, weaponhash); + + mp.events.add('render', () => { + // Draw to screen. + mp.game.graphics.drawText(weapon, [x + 2, y, z+ 0.5], { + font: 7, + color: [255, 255, 255, 185], + scale: [0.4, 0.4], + outline: true, + centre: true + }); + }); + + + mp.game.object.setPickupRegenerationTime(pickup, 1); + + mp.gui.chat.push("ausgeführt"); + }); + /*mp.events.add('playerWeaponShot', (targetPosition, targetEntity) => { for (var x in this.weaponAmmo) { if (this.weaponAmmo[x].id != this.currentWeapon) { diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 4b9907d9..e0f382ac 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -444,9 +444,10 @@ namespace ReallifeGamemode.Server.Commands { player.SafeTeleport(target.Position); player.Dimension = target.Dimension; + ChatService.SendMessage(player, "~c~* Du hast dich teleportiert."); } - ChatService.SendMessage(player, "~c~* Du hast dich teleportiert."); + } [Command("gh", "~m~Benutzung: ~s~/gh [Name]")] @@ -476,8 +477,9 @@ namespace ReallifeGamemode.Server.Commands { target.SafeTeleport(player.Position); target.Dimension = player.Dimension; + ChatService.SendMessage(target, "~c~* Du wurdest teleportiert."); } - ChatService.SendMessage(target, "~c~* Du wurdest teleportiert."); + } [Command("pm", "~m~Benutzung: ~s~/pm [Spieler] [Nachricht]", GreedyArg = true)] @@ -4031,6 +4033,40 @@ namespace ReallifeGamemode.Server.Commands ChatService.SendMessage(player, "~b~Du hast " + target.Name + " eine/n " + hash + " mit einer Munition von " + ammo + " gegeben."); } + [Command("setweaponpickup", "~m~Benutzung:~s~ /setweaponpickup [Waffe] [Munition] ", Alias = "swp")] + public void SetWeaponPickUp(Player player, string weapon, int ammo) + { + if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + + weapon = weapon.ToLower(); + + + if (!uint.TryParse(weapon, out uint uHash)) + { + if (weapon.Contains("mk2") && !weapon.Contains("_mk2")) weapon = weapon.Replace("mk2", "_mk2"); + uHash = NAPI.Util.GetHashKey($"weapon_{weapon}"); + } + + if (!WeaponManager.IsValidHash(uHash)) + { + ChatService.ErrorMessage(player, "Diese Waffe existiert nicht"); + return; + } + + if (!uint.TryParse(weapon, out uint uPickupHash)) + { + if (weapon.Contains("mk2") && !weapon.Contains("_mk2")) weapon = weapon.Replace("mk2", "_mk2"); + uPickupHash = NAPI.Util.GetHashKey($"PICKUP_WEAPON_{weapon}"); + } + + player.TriggerEvent("ADMIN:test", weapon, (PickupHash)uPickupHash, (WeaponHash)uHash, ammo, player.Position.X, player.Position.Y, player.Position.Z); + } + #endregion ALevel1337 #region ALevel1338