diff --git a/ReallifeGamemode.Client/CharCreator/main.ts b/ReallifeGamemode.Client/CharCreator/main.ts index 19ab25ac..5294d9db 100644 --- a/ReallifeGamemode.Client/CharCreator/main.ts +++ b/ReallifeGamemode.Client/CharCreator/main.ts @@ -237,10 +237,13 @@ export default function charCreator(globalData: IGlobalData) { saveItem.HighlightedBackColor = new Color(25, 118, 210); creatorMainMenu.AddItem(saveItem); - //let cancelItem = new UIMenuItem("Abbrechen", "Setzt alle \u00c4nderungen zur\u00fcck."); - //cancelItem.BackColor = new Color(213, 0, 0); - //cancelItem.HighlightedBackColor = new Color(229, 57, 53); - //creatorMainMenu.AddItem(cancelItem); + if (isSurgery) { + let cancelItem = new UIMenuItem("Abbrechen", "Bricht die Operation ab"); + cancelItem.BackColor = new Color(213, 0, 0); + cancelItem.HighlightedBackColor = new Color(229, 57, 53); + creatorMainMenu.AddItem(cancelItem); + } + creatorMainMenu.ListChange.on((item, listIndex) => { if (item === genderItem) { @@ -571,7 +574,7 @@ export default function charCreator(globalData: IGlobalData) { creatorCamera.pointAtCoord(creatorCoords.cameraLookAt.x, creatorCoords.cameraLookAt.y, creatorCoords.cameraLookAt.z); creatorCamera.setActive(true); } - + resetAppearanceMenu(); resetFeaturesMenu(); resetHairAndColorsMenu(); @@ -588,6 +591,7 @@ export default function charCreator(globalData: IGlobalData) { localPlayer.freezePosition(true); mp.game.cam.renderScriptCams(true, false, 0, true, false); applyCreatorOutfit(); + mp.events.callRemote("creator_GenderChange", 0); } }); @@ -611,5 +615,42 @@ export default function charCreator(globalData: IGlobalData) { globalData.InMenu = false; globalData.InMenu = false; if (isSurgery) isSurgery = false; + + } + + mp.events.add("render", () => { + if (mp.cameras.exists(creatorCamera)) disableInput(); + }); + + function disableInput() { + + //WASD + mp.game.controls.disableControlAction(0, 30, true); + mp.game.controls.disableControlAction(0, 31, true); + mp.game.controls.disableControlAction(0, 32, true); + mp.game.controls.disableControlAction(0, 33, true); + mp.game.controls.disableControlAction(0, 34, true); + mp.game.controls.disableControlAction(0, 35, true); + mp.game.controls.disableControlAction(0, 266, true); + mp.game.controls.disableControlAction(0, 267, true); + mp.game.controls.disableControlAction(0, 268, true); + mp.game.controls.disableControlAction(0, 269, true); + + //SPACE + mp.game.controls.disableControlAction(0, 22, true); + + //R + mp.game.controls.disableControlAction(0, 140, true); + mp.game.controls.disableControlAction(0, 263, true); + + //LMB + mp.game.controls.disableControlAction(0, 24, true); + mp.game.controls.disableControlAction(0, 257, true); + + //LEFT CTRL + mp.game.controls.disableControlAction(0, 36, true); + + //Q + mp.game.controls.disableControlAction(0, 44, true); } } \ No newline at end of file diff --git a/ReallifeGamemode.Client/admin/spectate.ts b/ReallifeGamemode.Client/admin/spectate.ts index cf66bb43..83483360 100644 --- a/ReallifeGamemode.Client/admin/spectate.ts +++ b/ReallifeGamemode.Client/admin/spectate.ts @@ -1,12 +1,27 @@ -let cam: CameraMp = mp.cameras.new('spectateCam');; +let cam: CameraMp; + +let specPlayer: PlayerMp; + mp.events.add("SERVER:ADMIN_SPECTATE", (targetPlayer) => { - cam.attachTo(targetPlayer.handle, 10.0, 0.0, 10.0, true); - cam.setActive(true); + //cam.attachTo(targetPlayer.handle, 0, 1.0, 1.0, 1.0, 0, 0, 0, true, false, false, false, 0, false); + specPlayer = targetPlayer; + cam = mp.cameras.new('spectateCam'); + cam.attachTo(targetPlayer.handle, 0, -4, 1.5, true); + cam.pointAt(targetPlayer.handle, 0, 0, 0, true); + cam.setActive(true); + mp.game.cam.renderScriptCams(true, false, 0, true, false); }); mp.events.add("SERVER:ADMIN_STOP_SPECTATE", () => { - if (cam.isActive() == true) { - cam.setActive(false); + if (mp.cameras.exists(cam)) { + cam.destroy(); + mp.game.cam.renderScriptCams(false, false, 0, true, false); + } +}); + +mp.events.add("render", () => { + if (mp.cameras.exists(cam)) { + cam.setRot(0, 0, specPlayer.getRotation(0).z, 0); } }); \ No newline at end of file diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index ec4e3d36..df0105a5 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -1796,14 +1796,23 @@ namespace ReallifeGamemode.Server.Commands return; } Player target; + + if (targetname != null) { target = PlayerService.GetPlayerByNameOrId(targetname); if (target == null || !target.IsLoggedIn()) { ChatService.PlayerNotFound(player); + return; + } + + if(target.Name == player.Name) + { + ChatService.ErrorMessage(player, "Du kannst dich nicht selbst spectaten"); return; } + player.TriggerEvent("SERVER:ADMIN_SPECTATE", target); } else