diff --git a/ReallifeGamemode.Client/Gui/infobox.ts b/ReallifeGamemode.Client/Gui/infobox.ts index b0a81b79..d0d30ba7 100644 --- a/ReallifeGamemode.Client/Gui/infobox.ts +++ b/ReallifeGamemode.Client/Gui/infobox.ts @@ -19,6 +19,7 @@ export default function (globalData: GlobalData): void { let countdown = 0; var cdTimestamp; var countdownText; + var blackScreenMode = false; let posX = 0.92; let posY = 0.45; @@ -64,6 +65,10 @@ export default function (globalData: GlobalData): void { dutyMode = toggle; }); + mp.events.add("toggleBlackScreen", (toggle) => { + blackScreenMode = toggle; + }); + mp.events.add("jailTime", (time) => { jailTime = time; }); @@ -282,5 +287,9 @@ export default function (globalData: GlobalData): void { }) } } + + if (blackScreenMode == true) { + mp.game.graphics.drawRect(0, 0, 10000, 100000, 0, 0, 0, 255); + } }); } \ No newline at end of file diff --git a/ReallifeGamemode.Client/Player/reportmenu.ts b/ReallifeGamemode.Client/Player/reportmenu.ts index f7630f30..f06cba4f 100644 --- a/ReallifeGamemode.Client/Player/reportmenu.ts +++ b/ReallifeGamemode.Client/Player/reportmenu.ts @@ -167,4 +167,5 @@ export default function reportList(globalData: GlobalData) { reportMenu.Close(); } }); + } \ No newline at end of file diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index afb4e2a2..97d076e9 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -157,4 +157,7 @@ import vehicleIndicators from './vehiclesync/vehicleindicators'; vehicleIndicators(); import reportList from './Player/reportmenu'; -reportList(globalData); \ No newline at end of file +reportList(globalData); + +import checkpointHandle from './util/checkpoint'; +checkpointHandle(globalData); \ No newline at end of file diff --git a/ReallifeGamemode.Client/util/checkpoint.ts b/ReallifeGamemode.Client/util/checkpoint.ts new file mode 100644 index 00000000..e9a28c70 --- /dev/null +++ b/ReallifeGamemode.Client/util/checkpoint.ts @@ -0,0 +1,35 @@ +import * as NativeUI from 'NativeUI'; +import InputHelper from '../inputhelper'; + +export default function checkpointHandle(globalData: GlobalData) { + var count = 0; + var myVar; + var posCp; + var Player; + var activeCheckpoint; + var inCheckpoint = false; + + mp.events.add('setCheckPoint', (position, player) => { + mp.gui.chat.push("exec"); + posCp = position; + Player = player; + activeCheckpoint = mp.markers.new(1, posCp, 3.0, { + color: [255, 0, 0, 150], + visible: true, + dimension: 0 + }); + + myVar = setInterval(myTimer, 100); + }); + + function myTimer() { + let dist = mp.game.gameplay.getDistanceBetweenCoords(Player.position.x, Player.position.y, 0, posCp.x, posCp.y, 0, false); + + if (dist <= 2 && !inCheckpoint) { + inCheckpoint = true; + mp.events.callRemote("playerInCheckpoint"); + } else if (dist > 2) { + inCheckpoint = false; + } + } +} \ No newline at end of file diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 7c8352d6..6e5a6767 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -17,7 +17,6 @@ using ReallifeGamemode.Server.Models; using ReallifeGamemode.Server.Job; using ReallifeGamemode.Server.Finance; using ReallifeGamemode.Server.Wanted; -using Microsoft.EntityFrameworkCore; /** * @overview Life of German Reallife - Admin Commands (Admin.cs) @@ -2599,12 +2598,6 @@ namespace ReallifeGamemode.Server.Commands dbContext.Users.Where(u => u.Id == nearHouse.OwnerId).First().HouseId = null; } - foreach(HouseRental rental in dbContext.HouseRentals.Include(r => r.User).Where(r => r.HouseId == nearHouse.Id)) - { - rental.User.Client?.SendChatMessage("Dein Mietvertrag wurde administrativ aufgelöst"); - dbContext.HouseRentals.Remove(rental); - } - dbContext.Houses.Remove(nearHouse); dbContext.SaveChanges(); @@ -2906,10 +2899,31 @@ namespace ReallifeGamemode.Server.Commands } } + [Command("blind", "~m~Benutzung: ~s~/blind")] + public void CmdBlind(Client player, String name, int mode) + { + if (!player.IsLoggedIn()) return; + + if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + Client target = ClientService.GetClientByNameOrId(name); + + if (mode == 1) + { + player.TriggerEvent("toggleBlackScreen", true); + } else if (mode == 0) + { + player.TriggerEvent("toggleBlackScreen", false); + } + } + [Command("makeadmin", "~m~Benutzung: ~s~/makeadmin [Name] [Adminlevel]")] public void CmdAdminSetadmin(Client player, string name, int rank) { - if ((!player.GetUser()?.IsAdmin(AdminLevel.PROJEKTLEITUNG) ?? true)) + if (!player.GetUser()?.IsAdmin(AdminLevel.PROJEKTLEITUNG) ?? true) { ChatService.NotAuthorized(player); return; diff --git a/ReallifeGamemode.Server/Commands/UserCommands.cs b/ReallifeGamemode.Server/Commands/UserCommands.cs index 0b58476c..30e98a67 100644 --- a/ReallifeGamemode.Server/Commands/UserCommands.cs +++ b/ReallifeGamemode.Server/Commands/UserCommands.cs @@ -12,7 +12,6 @@ namespace ReallifeGamemode.Server.Commands { class UserCommands : Script { - [Command("dice", "~m~Benutzung: ~s~/dice")] public void CmdUserDice(Client player) { @@ -28,8 +27,7 @@ namespace ReallifeGamemode.Server.Commands if (!managedClient.IsLoggedIn()) return; ChatService.SendMessage(managedClient, "* " + player.Name + " hat eine " + number + " gewürfelt."); } - } - + } [Command("car", "~m~Benutzung: ~s~/car")] public void CmdUserCar(Client player) diff --git a/ReallifeGamemode.Server/Util/CheckPointHandle.cs b/ReallifeGamemode.Server/Util/CheckPointHandle.cs new file mode 100644 index 00000000..9b1141b9 --- /dev/null +++ b/ReallifeGamemode.Server/Util/CheckPointHandle.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; +using ReallifeGamemode.Server.Entities; +using ReallifeGamemode.Server.Extensions; +using ReallifeGamemode.Server.Finance; +using ReallifeGamemode.Server.Models; +using ReallifeGamemode.Server.Services; +using ReallifeGamemode.Server.Util; +using GTANetworkAPI; + +namespace ReallifeGamemode.Server.Util +{ + class CheckPointHandle : Script + { + [Command("cp", "~m~Benutzung: ~s~/cp")] + public void CmdCp(Client player) + { + if (!player.IsLoggedIn()) return; + + Vector3 cp = player.Position; + + cp.X += 10; + player.TriggerEvent("setCheckPoint", cp, player); + } + + [RemoteEvent("playerInCheckpoint")] + public void enteredCheckpoints(Client user) + { + ChatService.SendMessage(user, "ja"); + Vector3 newCp = new Vector3(400, 680, 29); + user.TriggerEvent("setCheckpoint", newCp, user); + } + } +}