diff --git a/Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap-theme.css b/Client/Dependences/bootstrap-3.3.7/css/bootstrap-theme.css similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap-theme.css rename to Client/Dependences/bootstrap-3.3.7/css/bootstrap-theme.css diff --git a/Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap-theme.css.map b/Client/Dependences/bootstrap-3.3.7/css/bootstrap-theme.css.map similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap-theme.css.map rename to Client/Dependences/bootstrap-3.3.7/css/bootstrap-theme.css.map diff --git a/Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap-theme.min.css b/Client/Dependences/bootstrap-3.3.7/css/bootstrap-theme.min.css similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap-theme.min.css rename to Client/Dependences/bootstrap-3.3.7/css/bootstrap-theme.min.css diff --git a/Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap-theme.min.css.map b/Client/Dependences/bootstrap-3.3.7/css/bootstrap-theme.min.css.map similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap-theme.min.css.map rename to Client/Dependences/bootstrap-3.3.7/css/bootstrap-theme.min.css.map diff --git a/Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap.css b/Client/Dependences/bootstrap-3.3.7/css/bootstrap.css similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap.css rename to Client/Dependences/bootstrap-3.3.7/css/bootstrap.css diff --git a/Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap.css.map b/Client/Dependences/bootstrap-3.3.7/css/bootstrap.css.map similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap.css.map rename to Client/Dependences/bootstrap-3.3.7/css/bootstrap.css.map diff --git a/Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap.min.css b/Client/Dependences/bootstrap-3.3.7/css/bootstrap.min.css similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap.min.css rename to Client/Dependences/bootstrap-3.3.7/css/bootstrap.min.css diff --git a/Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap.min.css.map b/Client/Dependences/bootstrap-3.3.7/css/bootstrap.min.css.map similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/css/bootstrap.min.css.map rename to Client/Dependences/bootstrap-3.3.7/css/bootstrap.min.css.map diff --git a/Client/Login/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.eot b/Client/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.eot rename to Client/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.eot diff --git a/Client/Login/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.svg b/Client/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.svg rename to Client/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.svg diff --git a/Client/Login/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.ttf b/Client/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.ttf rename to Client/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.ttf diff --git a/Client/Login/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff b/Client/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff rename to Client/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff diff --git a/Client/Login/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff2 b/Client/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff2 similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff2 rename to Client/Dependences/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff2 diff --git a/Client/Login/Dependences/bootstrap-3.3.7/js/bootstrap.js b/Client/Dependences/bootstrap-3.3.7/js/bootstrap.js similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/js/bootstrap.js rename to Client/Dependences/bootstrap-3.3.7/js/bootstrap.js diff --git a/Client/Login/Dependences/bootstrap-3.3.7/js/bootstrap.min.js b/Client/Dependences/bootstrap-3.3.7/js/bootstrap.min.js similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/js/bootstrap.min.js rename to Client/Dependences/bootstrap-3.3.7/js/bootstrap.min.js diff --git a/Client/Login/Dependences/bootstrap-3.3.7/js/npm.js b/Client/Dependences/bootstrap-3.3.7/js/npm.js similarity index 100% rename from Client/Login/Dependences/bootstrap-3.3.7/js/npm.js rename to Client/Dependences/bootstrap-3.3.7/js/npm.js diff --git a/Client/Login/Dependences/jquery-3.3.1.min.js b/Client/Dependences/jquery-3.3.1.min.js similarity index 100% rename from Client/Login/Dependences/jquery-3.3.1.min.js rename to Client/Dependences/jquery-3.3.1.min.js diff --git a/Client/Gui/infobox.js b/Client/Gui/infobox.js new file mode 100644 index 00000000..63f9cb0f --- /dev/null +++ b/Client/Gui/infobox.js @@ -0,0 +1,119 @@ +/** + * @overview Life of German Reallife - Gui Infobox infobox.js + * @author VegaZ + * @copyright (c) 2008 - 2018 Life of German + */ + +var currentdate; +var timeString; + +var draw = false; + +var draw = false; +let posX = 0.92; +let posY = 0.45; +let width = 0.1; +let height = 0.2; +let colorR = 0; +let colorG = 0; +let colorB = 0; +let colorA = 72; + +var day; +var month; +var year; +var hour; +var minute; +var second; + +var nDay; +var nMonth; +var nHour; +var nMinute; +var nSecond; + +mp.events.add("draw", () => { + draw = true; +}); + +mp.events.add("render", () => { + + if (draw === true) { + currentdate = new Date(); + + day = currentdate.getDate(); + month = currentdate.getMonth(); + year = currentdate.getFullYear(); + + hour = currentdate.getHours(); + minute = currentdate.getMinutes(); + second = currentdate.getSeconds(); + + if (day < 10) { + nDay = "0" + day; + } else nDay = day; + + if (hour < 10) { + nHour = "0" + hour; + } else nHour = hour; + + if (minute < 10) { + nMinute = "0" + minute; + } else nMinute = minute; + + if (second < 10) { + nSecond = "0" + second; + } else nSecond = second; + + switch (month) { + case 0: + nMonth = "Jan."; + break; + case 1: + nMonth = "Feb."; + break; + case 2: + nMonth = "Mär."; + break; + case 3: + nMonth = "Apr."; + break; + case 4: + nMonth = "Mai"; + break; + case 5: + nMonth = "Jun."; + break; + case 6: + nMonth = "Jul."; + break; + case 7: + nMonth = "Aug."; + break; + case 8: + nMonth = "Sep."; + break; + case 9: + nMonth = "Okt."; + break; + case 10: + nMonth = "Nov."; + break; + case 11: + nMonth = "Dez."; + break; + + } + + timeString = "~r~Datum: ~s~" + nDay + ". " + nMonth + " " + year + "\n~r~Uhrzeit: ~s~" + nHour + ":" + nMinute + ":" + nSecond + " Uhr"; + + mp.game.graphics.drawRect(posX, posY, width, height, colorR, colorG, colorB, colorA); + mp.game.graphics.drawText(timeString, [0.92, 0.35], + { + font: 4, + color: [255, 255, 255, 255], + scale: [0.5, 0.5], + outline: true + }) + } +}); \ No newline at end of file diff --git a/Client/Login/login.html b/Client/Login/login.html index 0bfe5b52..03edc5c2 100644 --- a/Client/Login/login.html +++ b/Client/Login/login.html @@ -1,15 +1,14 @@  + - - @@ -20,73 +19,32 @@ ERROR TEXT
- -

+

Bereits registriert? Logg dich ein

- -

+

Nicht registriert? Erstelle einen Account

- + + + + +
+
+
+

Blip speichern, bitte fülle die Tabelle aus:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Model ID:
Name:
Skalierung:
Farbe:
Transparenz:
Draw Distance:
Short Range: + Zeigt das Blip nur innerhalb der Minimap +
Rotation:
Dimension:
+

+ +
+
+
+ + + \ No newline at end of file diff --git a/Client/Save/save.js b/Client/Save/save.js new file mode 100644 index 00000000..33a1ed72 --- /dev/null +++ b/Client/Save/save.js @@ -0,0 +1,28 @@ +/** + * @overview Life of German Reallife - Login Login login.js + * @author VegaZ + * @copyright (c) 2008 - 2018 Life of German + */ + +function saveData() { + let blipSprite = document.getElementById("blipSprite").value; + let blipName = document.getElementById("blipName").value; + let blipScale = document.getElementById("blipScale").value; + let blipColor = document.getElementById("blipColor").value; + let blipAlpha = document.getElementById("blipAlpha").value; + let blipDrawDistance = document.getElementById("blipSprite").value; + let blipShortRange = document.getElementById("blipShortRange").checked; + let blipRotation = document.getElementById("blipRotation").value; + let blipDimension = document.getElementById("blipDimension").value; + + mp.trigger("saveData", blipSprite, blipName, blipScale, blipColor, blipAlpha, blipDrawDistance, blipShortRange, blipRotation, blipDimension); +} + +function cancelData() { + mp.trigger("cancelData"); +} + +function getType() { + mp.gui.chat.push("getType"); + return typ; +} \ No newline at end of file diff --git a/Client/Save/style.css b/Client/Save/style.css new file mode 100644 index 00000000..e295d68d --- /dev/null +++ b/Client/Save/style.css @@ -0,0 +1,184 @@ +/** + * @overview Life of German Reallife - Save CSS style.css + * @author Orangebox, hydrant, VegaZ + * @copyright (c) 2008 - 2018 Life of German + */ + +.save-page { + margin: auto; +} + +.isa_info, .isa_success, .isa_warning, .isa_error { + margin: 10px 0px; + padding: 12px; + display: none; +} + +.isa_info { + color: #00529B; + background-color: #BDE5F8; +} + +.isa_success { + color: #4F8A10; + background-color: #DFF2BF; +} + +.isa_warning { + color: #9F6000; + background-color: #FEEFB3; +} + +.isa_error { + color: #D8000C; + background-color: #FFBABA; +} + +.isa_info i, .isa_success i, .isa_warning i, .isa_error i { + margin: 10px 22px; + font-size: 2em; + vertical-align: middle; +} + +.form { + margin-left: 36%; + position: absolute; + z-index: 1; + background: rgba(255, 255, 255, .85); + padding: 20px; + text-align: center; + box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24); +} + +input { + font-family: "Roboto", sans-serif; + outline: 0; + background: #f2f2f2; + width: 100%; + border: 0; + margin: 5px 0 5px 0; + padding: 12px; + box-sizing: border-box; + font-size: 12px; +} + input.colorPicker { + font-family: "Roboto", sans-serif; + outline: 0; + background: #f2f2f2; + width: 100%; + border: 0; + margin: 5px 0 5px 0; + padding: 0px; + box-sizing: border-box; + font-size: 12px; + } + + input#blipShortRange { + margin: 10px 0 10px 0; + } + +button { + font-family: "Roboto", sans-serif; + text-transform: uppercase; + outline: 0; + background: #31c474; + width: 40%; + border: 0; + padding: 15px; + color: #FFFFFF; + font-size: 14px; + -webkit-transition: all 0.3s ease; + transition: all 0.3s ease; + cursor: pointer; +} + + button:hover, .form button:active, .form button:focus { + background: #31bd40; + } + +.cancelBtn { + background-color: orangered; +} + +.cancelBtn:hover, .cancelBtn:focus, .cancelBtn:active { + background-color: #ff0223 !important; +} + +table { + align-self: center; +} +.message { + margin: 15px 0 0; + font-size: 12px; +} + +.message a { + color: #0035A5; + text-decoration: none; +} + +.register-form { + display: none; +} + + +.container { + position: relative; + z-index: 1; + max-width: 300px; + margin: 0 auto; +} + +.container:before, .container:after { + content: ""; + display: block; + clear: both; +} + +.container .info { + margin: 50px auto; + text-align: center; +} + +.info h1 { + margin: 0 0 15px; + padding: 0; + font-size: 36px; + font-weight: 300; + color: #1a1a1a; +} + +.info span { + color: #4d4d4d; + font-size: 12px; +} + +.info span a { + color: #000000; + text-decoration: none; +} + +.info span .fa { + color: #EF3B3A; +} + +body { + font-family: "Roboto", sans-serif; + -webkit-font-smoothing: antialiased; + overflow: hidden; +} +tr{ + +} +td { + align-content: stretch; + padding-left: 10px; + padding-right: 10px; + box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(0, 0, 0, 0.24); + border-top: 2px double gray; + border-bottom: 2px double gray; + border-width: 0.5px; +} +table{ + margin-bottom: 20px; +} \ No newline at end of file diff --git a/Client/index.js b/Client/index.js index 51689880..1ece4ca7 100644 --- a/Client/index.js +++ b/Client/index.js @@ -4,4 +4,7 @@ * @copyright (c) 2008 - 2018 Life of German */ -require('./Login/main.js'); \ No newline at end of file +require('./Gui/infobox.js'); +require('./Login/main.js'); +require('./Save/main.js'); +require('./Save/save.js'); diff --git a/Main.cs b/Main.cs index e1aea960..3f6166a1 100644 --- a/Main.cs +++ b/Main.cs @@ -1,5 +1,7 @@ using System; +using System.Linq; using GTANetworkAPI; +using reallife_gamemode.Model; /** * @overview Life of German Reallife - Main Class (Main.cs) @@ -11,11 +13,21 @@ namespace reallife_gamemode { public class Main : Script { + public static readonly Vector3 DEFAULT_SPAWN_POSITION = new Vector3(-427.5189, 1116.453, 326.7829); + public static readonly float DEFAULT_SPAWN_HEADING = 340.8f; + [ServerEvent(Event.ResourceStart)] public void OnResourceStart() { NAPI.Server.SetCommandErrorMessage("~r~[FEHLER]~s~ Dieser Command existiert nicht."); - NAPI.Util.ConsoleOutput("reallife-gamemode resource loaded!"); + NAPI.Server.SetDefaultSpawnLocation(DEFAULT_SPAWN_POSITION, DEFAULT_SPAWN_HEADING); + NAPI.Server.SetAutoSpawnOnConnect(false); + + using (var context = new DatabaseContext()) + { + context.Users.FirstOrDefault(); + context.SaveChanges(); + } } } } \ No newline at end of file diff --git a/Model/DatabaseContext.cs b/Model/DatabaseContext.cs index 296b503a..6b60c4b8 100644 --- a/Model/DatabaseContext.cs +++ b/Model/DatabaseContext.cs @@ -1,8 +1,10 @@ using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Configuration; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.Extensions.Configuration; /** * @overview Life of German Reallife - DatabaseContext.cs @@ -35,5 +37,12 @@ namespace reallife_gamemode.Model } public DbSet Users { get; set; } + + public DbSet Blips { get; set; } + public DbSet Markers { get; set; } + public DbSet Peds { get; set; } + public DbSet Pickups { get; set; } + public DbSet TextLabels { get; set; } + public DbSet Vehicles { get; set; } } } diff --git a/Server/Commands/Admin.cs b/Server/Commands/Admin.cs index 69cd9cae..768b1ffd 100644 --- a/Server/Commands/Admin.cs +++ b/Server/Commands/Admin.cs @@ -2,13 +2,18 @@ using System.Collections.Generic; using System.Text; using GTANetworkAPI; +using reallife_gamemode.Server.Events; using reallife_gamemode.Server.Extensions; using reallife_gamemode.Server.Services; using reallife_gamemode.Server.Util; /** * @overview Life of German Reallife - Admin Commands (Admin.cs) +<<<<<<< HEAD * @author VegaZ, hydrant, balbo +======= +* @author VegaZ, hydrant, xSprite +>>>>>>> 5e0e0d82f2d05dda2954836a69347d4433839f85 * @copyright (c) 2008 - 2018 Life of German */ @@ -19,6 +24,11 @@ namespace reallife_gamemode.Server.Commands [Command("o", "~m~Benutzung: ~s~/o [Nachricht]", GreedyArg = true)] public void CmdAdminO(Client player, string message) { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) { ChatService.NotAuthorized(player); @@ -32,6 +42,11 @@ namespace reallife_gamemode.Server.Commands [Command("veh", "~m~Benutzung: ~s~/veh [Fahrzeug] (Farbe 1) (Farbe 2)")] public void CmdAdminVeh(Client player, VehicleHash hash, int color1 = 111, int color2 = 111) { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) { ChatService.NotAuthorized(player); @@ -47,18 +62,24 @@ namespace reallife_gamemode.Server.Commands Vehicle v = NAPI.Vehicle.CreateVehicle(hash, player.Position, player.Rotation.Z, color1, color2); player.SetIntoVehicle(v.Handle, -1); + player.SendChatMessage("Maxspeed: + " +player.Vehicle.MaxSpeed + ""); } - [Command("fixveh")] + [Command("fv")] public void CmdAdminFixveh(Client player) { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) { ChatService.NotAuthorized(player); return; } - if (!player.IsInVehicle) // Man darf keine Autos erstellen, wenn man selbst in einem sitzt (verhindert Bugs) + if (!player.IsInVehicle) { player.SendChatMessage("~r~[FEHLER]~s~ Du sitzt momentan nicht in einem Fahrzeug."); return; @@ -67,9 +88,14 @@ namespace reallife_gamemode.Server.Commands player.Vehicle.Repair(); } - [Command("delveh")] + [Command("vdestroy")] public void CmdAdminDelveh(Client player) { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) { ChatService.NotAuthorized(player); @@ -88,9 +114,14 @@ namespace reallife_gamemode.Server.Commands player.Vehicle.Delete(); } - [Command("goto", "~m~Benutzung: ~s~/goto [Name]")] + [Command("to", "~m~Benutzung: ~s~/to [Name]")] public void CmdAdminGoto(Client player, string name) { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) { ChatService.NotAuthorized(player); @@ -108,9 +139,31 @@ namespace reallife_gamemode.Server.Commands player.Position = target.Position; } - [Command("gotoxyz", "~m~Benutzung: ~s~/gotoxyz [X] [Y] [Z]")] + [Command("position")] + public void CmdAdminShowPos(Client player) + { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + player.SendChatMessage("Position: X Y Z: " + player.Position + ""); + } + + [Command("gotox", "~m~Benutzung: ~s~/gotox [X] [Y] [Z]")] public void CmdAdminGotoxyz(Client player, float x, float y, float z) { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) { ChatService.NotAuthorized(player); @@ -120,9 +173,14 @@ namespace reallife_gamemode.Server.Commands player.Position = new Vector3(x, y, z); } - [Command("gethere", "~m~Benutzung: ~s~/goto [Name]")] + [Command("gh", "~m~Benutzung: ~s~/gh [Name]")] public void CmdAdminGethere(Client player, string name) { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) { ChatService.NotAuthorized(player); @@ -138,11 +196,17 @@ namespace reallife_gamemode.Server.Commands } target.Position = player.Position; + target.SendChatMessage("Du wurdest von " + player.Name + " teleportiert."); } [Command("ipl", "~m~Benutzung: ~s~/ipl [Load / Remove] [Name]")] public void CmdAdminIpl(Client player, string option, string name) { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) { ChatService.NotAuthorized(player); @@ -170,6 +234,11 @@ namespace reallife_gamemode.Server.Commands [Command("giveweapon", "~m~Benutzung: ~s~/giveweapon [Spieler] [Waffe] [Munition]")] public void CmdAdminGiveweapon(Client player, string name, string weapon, int ammo) { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) { ChatService.NotAuthorized(player); @@ -185,7 +254,7 @@ namespace reallife_gamemode.Server.Commands Client target = ClientService.GetClientByName(name); if (target == null) { - ChatService.PlayerNotFound(target); + ChatService.PlayerNotFound(player); return; } @@ -198,6 +267,296 @@ namespace reallife_gamemode.Server.Commands } target.GiveWeapon(wHash, ammo); + target.SendChatMessage("~b~Du hast von " +player.Name +" eine/n " + wHash + " mit einer Munition von " +ammo + " erhalten."); + player.SendChatMessage("~b~Du hast " + target.Name + " eine/n " + wHash + " mit einer Munition von " + ammo + " gegeben."); + } + + [Command("sethp", "~m~Benutzung: ~s~/sethp [Spieler] (Leben)")] + public void CmdAdminSetHp(Client player, string name, int hp = 100) + { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + Client target = ClientService.GetClientByName(name); + if (target == null) + { + ChatService.PlayerNotFound(player); + return; + } + + target.Health = hp; + target.SendChatMessage("~b~Dein Leben wurde von " + player.Name + " auf " + hp + " gesetzt."); + player.SendChatMessage("~b~Du hast das Leben von " + target.Name + " auf " + hp + " gesetzt."); + } + + [Command("setarmor", "~m~Benutzung: ~s~/setarmor [Spieler] (Armor)")] + public void CmdAdminSetArmor(Client player, string name, int armor = 100) + { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + Client target = ClientService.GetClientByName(name); + if (target == null) + { + ChatService.PlayerNotFound(player); + return; + } + + target.Armor = armor; + target.SendChatMessage("~b~Deine Rüstung wurde von " + player.Name + " auf " + armor + " gesetzt."); + player.SendChatMessage("~b~Du hast die Rüstung von " + target.Name + " auf " + armor + " gesetzt."); + } + + [Command("setskin", "~m~Benutzung: ~s~/setskin [Spieler] [Skin]")] + public void CmdAdminSetSkin(Client player, string name, string Skin) + { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + Client target = ClientService.GetClientByName(name); + if (target == null) + { + ChatService.PlayerNotFound(player); + return; + } + + var skin = NAPI.Util.PedNameToModel(Skin); + target.SendChatMessage("~b~Dein Skin wurde von " + player.Name + " zu " + skin + " gesetzt."); + player.SendChatMessage("~b~Du hast den Skin von " + target.Name + " zu " + skin + " gesetzt."); + target.SetSkin(NAPI.Util.PedNameToModel(Skin)); + } + + [Command("vcolor", "~m~Benutzung: ~s~/vcolor [Farb-ID1] [Farb-ID2]")] + public void CmdAdminColor(Client player, int color1, int color2) + { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + if (!player.IsInVehicle) + { + player.SendChatMessage("~r~[FEHLER]~s~ Du sitzt momentan in keinem Fahrzeug!"); + return; + } + + player.Vehicle.PrimaryColor = color1; + player.Vehicle.SecondaryColor = color2; + player.SendChatMessage("Farb-ID1 " + color1 + ", Farb-ID2 " + color2 + ""); + } + + [Command("aw", "~m~Benutzung: ~s~/aw [Spieler] [Nachricht]")] + public void CmdAdminMsg(Client player, string name, string msg) + { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + Client target = ClientService.GetClientByName(name); + if (target == null) + { + ChatService.PlayerNotFound(player); + return; + } + if (target == player) + { + ChatService.ErrorMsg(player); + return; + } + target.SendChatMessage("~y~PM von "+ player.Name + ": " + msg +" "); + player.SendChatMessage("~y~PM an "+ target.Name + ": " + msg + " "); + } + + [Command("takeweapon", "~m~Benutzung: ~s~/takeweapon [Spieler]")] + public void CmdAdminTakeWeapon(Client player, string name) + { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + Client target = ClientService.GetClientByName(name); + if (target == null) + { + ChatService.PlayerNotFound(player); + return; + } + player.RemoveAllWeapons(); + target.SendChatMessage("~b~Deine Waffen wurden dir von " + player.Name + "(Admin) abgenommen"); + player.SendChatMessage("~b~Dem Spieler " + target.Name + " wurden erfolgreich alle Waffen abgenommen "); + } + + [Command("rsethp", "~m~Benutzung: ~s~/rsethp [Radius] (Leben)")] + public void CmdAdminRangeSetHP(Client player, float radius, int hp = 100) + { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + var peopleInRange = NAPI.Player.GetPlayersInRadiusOfPlayer(radius, player); + + foreach (var managedClient in peopleInRange) + { + managedClient.Health = hp; + managedClient.SendChatMessage("~b~Admin "+ player.Name + " hat im Radius von " + radius + " die HP auf " + hp + " gesetzt."); + } + player.SendChatMessage("~b~Das Leben von " + peopleInRange.Count + " Spielern wurde auf "+ hp + " gesetzt."); + } + + [Command("rsetarmor", "~m~Benutzung: ~s~/rsetarmor [Radius] (Armor)")] + public void CmdAdminRangeSetArmor(Client player, float radius, int Armor = 100) + { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + var peopleInRange = NAPI.Player.GetPlayersInRadiusOfPlayer(radius, player); + + foreach (var managedClient in peopleInRange) + { + managedClient.Health = Armor; + managedClient.SendChatMessage("~b~Admin " + player.Name + " hat im Radius von " + radius + " die Rüstung auf " + Armor + " gesetzt."); + } + player.SendChatMessage("~b~Die Rüstung von " + peopleInRange.Count + " Spielern wurde auf " + Armor + " gesetzt."); + } + + [Command("time", "~m~Benutzung: ~s~/time [Stunde] (Minuten) (Sekunden)")] + public void CmdAdminSetTime(Client player, int hour, int min = 0, int sec = 0) + { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + NAPI.World.SetTime(hour, min, sec); + NAPI.Chat.SendChatMessageToAll("Serverzeit auf " + hour + ":" + min + ":" + sec + " gestellt"); + + } + [Command("val")] + public void Val(Client player) + { + NAPI.Chat.SendChatMessageToAll("Value of " + player.Name + ": " + player.Handle.Value); + } + [Command("rgiveweapon", "~m~Benutzung: ~s~/rgiveweapon [Radius] [Waffe] [Munition]")] + public void CmdAdminRangeGiveWeapon(Client player, float radius, string weapon, int munition) + { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + WeaponHash wHash = NAPI.Util.WeaponNameToModel(weapon); + + if (wHash == default(WeaponHash)) + { + player.SendChatMessage("~r~[FEHLER]~s~ Diese Waffe existiert nicht."); + return; + } + + var peopleInRange = NAPI.Player.GetPlayersInRadiusOfPlayer(radius, player); + + foreach (var managedClient in peopleInRange) + { + managedClient.GiveWeapon(wHash, munition); + managedClient.SendChatMessage("~b~Admin " +player.Name + " hat im Radius von " + radius + " eine/n " + weapon +" mit " + munition +" Munition vergeben."); + } + player.SendChatMessage("~b~Du hast " + peopleInRange.Count +" Spielern eine " + weapon + " mit " + munition + " Munition gegeben"); + } + + [Command("save", "~m~Benutzung: ~s~/save [Typ = ~g~Blip, ~r~Marker, Ped, Pickup, TextLabel, ~g~Vehicle")] + public void CmdAdminSave(Client player, string typ) + { + if (ClientExtension.IsLoggedIn(player) == false) + { + ChatService.PlayerNotLoggedIn(player); + return; + } + if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + switch (typ) + { + case "Blip": + player.TriggerEvent("saveBlip"); + break; + case "Vehicle": + if (player.IsInVehicle) + { + Vehicle vehicle = player.Vehicle; + SaveData.SaveVehicleData((VehicleHash) vehicle.Model, vehicle.Position, vehicle.Heading, vehicle.NumberPlate, + Convert.ToByte(vehicle.PrimaryColor), Convert.ToByte(vehicle.SecondaryColor), vehicle.Locked, vehicle.EngineStatus, Convert.ToByte(vehicle.Dimension)); + } + else player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!"); + break; + + } + } [Command("a", "~m~Benutzung: ~s~/a [Nachricht]")] diff --git a/Server/Entities/User.cs b/Server/Entities/User.cs index 1f0a934d..5f8532e1 100644 --- a/Server/Entities/User.cs +++ b/Server/Entities/User.cs @@ -25,7 +25,8 @@ namespace reallife_gamemode.Server.Entities [StringLength(64)] public string Password { get; set; } public int LogUserId { get; set; } - public DateTime RegistrationDate { get; set; } + [Timestamp] + public byte[] RegistrationDate { get; set; } [EmailAddress] [StringLength(64)] public string Email { get; set; } diff --git a/Server/Events/Connect.cs b/Server/Events/Connect.cs index 59167107..69e1552b 100644 --- a/Server/Events/Connect.cs +++ b/Server/Events/Connect.cs @@ -20,7 +20,9 @@ namespace reallife_gamemode.Server.Events [ServerEvent(Event.PlayerConnected)] public void OnPlayerConnected(Client player) { - + player.SetData("isLoggedIn", false); + player.Position = new Vector3(-1883.736, -781.4911, -10); + player.FreezePosition = true; } } diff --git a/Server/Events/Disconnect.cs b/Server/Events/Disconnect.cs new file mode 100644 index 00000000..defec9b7 --- /dev/null +++ b/Server/Events/Disconnect.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; +using GTANetworkAPI; + +/** +* @overview Life of German Reallife - Event Login (Login.cs) +* @author VegaZ +* @copyright (c) 2008 - 2018 Life of German +*/ + +namespace reallife_gamemode.Server.Events +{ + class Disconnect : Script + { + [ServerEvent(Event.PlayerDisconnected)] + public void OnPlayerDisconnected(Client player) + { + player.SetData("isLoggedIn", false); + } + + } +} \ No newline at end of file diff --git a/Server/Events/Login.cs b/Server/Events/Login.cs index 04ebb9b0..a6534280 100644 --- a/Server/Events/Login.cs +++ b/Server/Events/Login.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text; using GTANetworkAPI; @@ -14,15 +15,38 @@ namespace reallife_gamemode.Server.Events public class Login : Script { [RemoteEvent("OnPlayerLogin")] - public void OnPlayerLogin(Client player, string username, string password) + public void OnPlayerLogin(Client player, string password) { - - } + using (var loginUser = new Model.DatabaseContext()) + { + var user = loginUser.Users.SingleOrDefault(b => b.Name == player.Name); - [RemoteEvent("OnPlayerRegister")] - public void OnPlayerRegister(Client player, string username, string password) - { - - } - } + if(user == null) + { + player.TriggerEvent("loginFail", "Benutzer existiert nicht! Registriere dich zuerst!"); + } + else + { + if (user.SocialClubName != player.SocialClubName && user.Password == NAPI.Util.GetHashSha256(password)) + { + player.TriggerEvent("loginDeny", "Dieser Benutzer gehört dir nicht!"); + //Log einbauen für den bösen Bub. + player.Kick(); + } + if (user.Password != NAPI.Util.GetHashSha256(password)) + { + player.TriggerEvent("loginFail", "Passwort inkorrekt!"); + } + else + { + player.TriggerEvent("loginSuccess"); + NAPI.Player.SpawnPlayer(player, Main.DEFAULT_SPAWN_POSITION, Main.DEFAULT_SPAWN_HEADING); + + player.SetData("isLoggedIn", true); + player.TriggerEvent("draw"); + } + } + } + } + } } diff --git a/Server/Events/Register.cs b/Server/Events/Register.cs new file mode 100644 index 00000000..fbc45ecf --- /dev/null +++ b/Server/Events/Register.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GTANetworkAPI; + +/** +* @overview Life of German Reallife - Event Register (Register.cs) +* @author VegaZ +* @copyright (c) 2008 - 2018 Life of German +*/ + +namespace reallife_gamemode.Server.Events +{ + class Register : Script + { + [RemoteEvent("OnPlayerRegister")] + public void OnPlayerRegister(Client player, string password) + { + using (var checkUser = new Model.DatabaseContext()) + { + var checkedUser = checkUser.Users.SingleOrDefault(b => b.Name == player.Name); + if (checkedUser == null) + { + using (var registerUser = new Model.DatabaseContext()) + { + var user = new Entities.User { Name = player.Name, SocialClubName = player.SocialClubName, Password = NAPI.Util.GetHashSha256(password) }; + registerUser.Users.Add(user); + registerUser.SaveChanges(); + } + player.TriggerEvent("registerSuccess"); + NAPI.Player.SpawnPlayer(player, Main.DEFAULT_SPAWN_POSITION, Main.DEFAULT_SPAWN_HEADING); + } + else if (player.SocialClubName == checkedUser.SocialClubName) + { + player.TriggerEvent("registerFail", "Dieser SocialClubAccount ist schon registriert!"); + } + else if (checkedUser.Name == player.Name) + { + player.TriggerEvent("registerFail", "Benutzername existiert schon!"); + } + } + } + } +} diff --git a/Server/Events/SaveData.cs b/Server/Events/SaveData.cs new file mode 100644 index 00000000..01d32054 --- /dev/null +++ b/Server/Events/SaveData.cs @@ -0,0 +1,78 @@ +using GTANetworkAPI; +using System; +using System.Collections.Generic; +using System.Text; + +namespace reallife_gamemode.Server.Events +{ + public class SaveData : Script + { + [RemoteEvent("OnSaveBlipData")] + public void OnSaveBlipData(Client player, string blipSprite, string blipName, string blipScale, string blipColor, + string blipAlpha, string blipDrawDistance, string blipShortRange, string blipRotation, string blipDimension) + { + float x = player.Position.X; + float y = player.Position.Y; + float z = player.Position.Z; + short sprite = short.Parse(blipSprite); + string name = blipName; + float scale = float.Parse(blipScale); + byte color = Convert.ToByte(blipColor); + byte alpha = Convert.ToByte(blipAlpha); + float drawDistance = float.Parse(blipDrawDistance); + bool shortRange = bool.Parse(blipShortRange); + float rotation = float.Parse(blipRotation); + byte dimension = Convert.ToByte(blipDimension); + + NAPI.Blip.CreateBlip(uint.Parse(blipSprite), new Vector3(x,y,z), scale, color, name, alpha, drawDistance, shortRange, short.Parse(blipRotation), dimension); + + using (var saveData = new Model.DatabaseContext()) + { + var dataSet = new Server.Saves.SavedBlip + { + Sprite = sprite, + PositionX = x, + PositionY = y, + PositionZ = z, + Name = blipName, + Scale = scale, + Color = color, + Alpha = alpha, + DrawDistance = drawDistance, + ShortRange = shortRange, + Rotation = rotation, + Dimension = dimension, + Active = true + }; + saveData.Blips.Add(dataSet); + saveData.SaveChanges(); + } + } + + public static void SaveVehicleData(VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading, + string vehicleNumberPlate, byte vehiclePrimaryColor, byte vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, byte vehicleDimension) + { + using (var saveData = new Model.DatabaseContext()) + { + var dataSet = new Server.Saves.SavedVehicle + { + Model = vehicleModel, + PositionX = vehiclePosition.X, + PositionY = vehiclePosition.Y, + PositionZ = vehiclePosition.Z, + Heading = vehicleHeading, + NumberPlate = vehicleNumberPlate, + PrimaryColor = vehiclePrimaryColor, + SecondaryColor = vehicleSecondaryColor, + Locked = vehicleLocked, + Engine = vehicleEngine, + Dimension = vehicleDimension, + Active = true + }; + saveData.Vehicles.Add(dataSet); + saveData.SaveChanges(); + } + } + + } +} diff --git a/Server/Events/Spawn.cs b/Server/Events/Spawn.cs index 02d3d38a..518a76a5 100644 --- a/Server/Events/Spawn.cs +++ b/Server/Events/Spawn.cs @@ -20,7 +20,6 @@ namespace reallife_gamemode.Server.Events [ServerEvent(Event.PlayerSpawn)] public void OnPlayerSpawn(Client player) { - } } } diff --git a/Server/Extensions/ClientExtension.cs b/Server/Extensions/ClientExtension.cs index 38aed1ac..d45bede9 100644 --- a/Server/Extensions/ClientExtension.cs +++ b/Server/Extensions/ClientExtension.cs @@ -23,5 +23,10 @@ namespace reallife_gamemode.Server.Extensions return dbContext.Users.FirstOrDefault(u => u.Name == client.Name); } } + + public static bool IsLoggedIn(Client player) + { + return player.GetData("isLoggedIn"); + } } } diff --git a/Server/Managers/LoadManager.cs b/Server/Managers/LoadManager.cs new file mode 100644 index 00000000..4384c916 --- /dev/null +++ b/Server/Managers/LoadManager.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Text; +using GTANetworkAPI; +using reallife_gamemode.Model; +using reallife_gamemode.Server.Entities; + +/** +* @overview Life of German Reallife - Managers LoadManager (LoadManager.cs) +* @author VegaZ +* @copyright (c) 2008 - 2018 Life of German +*/ + +namespace reallife_gamemode.Server.Managers +{ + public class LoadManager : Script + { + [ServerEvent(Event.ResourceStart)] + public void OnResourceStart() + { + using (var loadData = new DatabaseContext()) + { + //LOAD ALL BLIPS + foreach (Saves.SavedBlip b in loadData.Blips) + { + if(b.Active == true) + { + NAPI.Blip.CreateBlip((uint) b.Sprite, new Vector3(b.PositionX, b.PositionY, b.PositionZ), b.Scale, + b.Color, b.Name, b.Alpha, b.DrawDistance, b.ShortRange, (short) b.Rotation, b.Dimension); + } + } + //LOAD ALL VEHICLES + foreach (Saves.SavedVehicle v in loadData.Vehicles) + { + if (v.Active == true) + { + NAPI.Vehicle.CreateVehicle((uint)v.Model, new Vector3(v.PositionX, v.PositionY, v.PositionZ), v.Heading, (int)(v.PrimaryColor), + v.SecondaryColor, v.NumberPlate, v.Alpha, v.Locked, v.Engine = false, v.Dimension); + } + } + } + } + } +} diff --git a/Server/Saves/SavedBlip.cs b/Server/Saves/SavedBlip.cs new file mode 100644 index 00000000..f7b14343 --- /dev/null +++ b/Server/Saves/SavedBlip.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +/** + * @overview Life of German Reallife - Saves SavedBlip.cs + * @author VegaZ + * @copyright (c) 2008 - 2018 Life of German + */ + +namespace reallife_gamemode.Server.Saves +{ + public class SavedBlip + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } + [Required] + public short Sprite { get; set; } + [Required] + public float PositionX { get; set; } + [Required] + public float PositionY { get; set; } + [Required] + public float PositionZ { get; set; } + public string Name { get; set; } + public float Scale { get; set; } + public byte Color { get; set; } + public byte Alpha { get; set; } + public float DrawDistance { get; set; } + public bool ShortRange { get; set; } + public float Rotation { get; set; } + public byte Dimension { get; set; } + public bool Active { get; set; } + } +} diff --git a/Server/Saves/SavedMarker.cs b/Server/Saves/SavedMarker.cs new file mode 100644 index 00000000..5670d0f7 --- /dev/null +++ b/Server/Saves/SavedMarker.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +/** + * @overview Life of German Reallife - Saves SavedMarker.cs + * @author VegaZ + * @copyright (c) 2008 - 2018 Life of German + */ + +namespace reallife_gamemode.Server.Saves +{ + public class SavedMarker + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } + public byte Type { get; set; } + public float PositionX { get; set; } + public float PositionY { get; set; } + public float PositionZ { get; set; } + public float Scale { get; set; } + public float DirectionX { get; set; } + public float DirectionY { get; set; } + public float DirectionZ { get; set; } + public float RotationX { get; set; } + public float RotationY { get; set; } + public float RotationZ { get; set; } + public byte ColorR { get; set; } + public byte ColorG { get; set; } + public byte ColorB { get; set; } + public byte ColorA { get; set; } + public bool Visible { get; set; } + public byte Dimension { get; set; } + public bool Active { get; set; } + } +} diff --git a/Server/Saves/SavedPed.cs b/Server/Saves/SavedPed.cs new file mode 100644 index 00000000..627ec516 --- /dev/null +++ b/Server/Saves/SavedPed.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +/** + * @overview Life of German Reallife - Saves SavedPed.cs + * @author VegaZ + * @copyright (c) 2008 - 2018 Life of German + */ + +namespace reallife_gamemode.Server.Saves +{ + public class SavedPed + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } + public string HashModel { get; set; } + public float PositionX { get; set; } + public float PositionY { get; set; } + public float PositionZ { get; set; } + public float Heading { get; set; } + public byte Dimension { get; set; } + public bool Active { get; set; } + } +} diff --git a/Server/Saves/SavedPickup.cs b/Server/Saves/SavedPickup.cs new file mode 100644 index 00000000..5c518de5 --- /dev/null +++ b/Server/Saves/SavedPickup.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +/** + * @overview Life of German Reallife - Saves SavedPickup.cs + * @author VegaZ + * @copyright (c) 2008 - 2018 Life of German + */ + +namespace reallife_gamemode.Server.Saves +{ + public class SavedPickup + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } + [StringLength(128)] + public float PositionX { get; set; } + public float PositionY { get; set; } + public float PositionZ { get; set; } + public float RotationX { get; set; } + public float RotationY { get; set; } + public float RotationZ { get; set; } + public bool Vehicle { get; set; } + public int RespawnTime { get; set; } + public byte Dimension { get; set; } + public bool Active { get; set; } + } +} diff --git a/Server/Saves/SavedTextLabel.cs b/Server/Saves/SavedTextLabel.cs new file mode 100644 index 00000000..d367bfbf --- /dev/null +++ b/Server/Saves/SavedTextLabel.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +/** + * @overview Life of German Reallife - Saves SavedTextLabel.cs + * @author VegaZ + * @copyright (c) 2008 - 2018 Life of German + */ + +namespace reallife_gamemode.Server.Saves +{ + public class SavedTextLabel + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } + [Required] + public string Text { get; set; } + [Required] + public float PositionX { get; set; } + [Required] + public float PositionY { get; set; } + [Required] + public float PositionZ { get; set; } + public bool LOS { get; set; } + public byte Font { get; set; } + public float DrawDistance { get; set; } + public byte ColorR { get; set; } + public byte ColorG { get; set; } + public byte ColorB { get; set; } + public byte ColorA { get; set; } + public byte Dimension { get; set; } + public bool Active { get; set; } + } +} diff --git a/Server/Saves/SavedVehicle.cs b/Server/Saves/SavedVehicle.cs new file mode 100644 index 00000000..7653474c --- /dev/null +++ b/Server/Saves/SavedVehicle.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using GTANetworkAPI; + +/** + * @overview Life of German Reallife - Saves SavedVehicle.cs + * @author VegaZ + * @copyright (c) 2008 - 2018 Life of German + */ + +namespace reallife_gamemode.Server.Saves +{ + public class SavedVehicle + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } + public VehicleHash Model { get; set; } + public float PositionX { get; set; } + public float PositionY { get; set; } + public float PositionZ { get; set; } + public float Heading { get; set; } + [StringLength(8)] + public string NumberPlate { get; set; } + public byte Alpha { get; set; } + public byte PrimaryColor { get; set; } + public byte SecondaryColor { get; set; } + public bool Locked { get; set; } + public bool Engine { get; set; } + public byte Dimension { get; set; } + public bool Active { get; set; } + } +} diff --git a/Server/Services/ChatService.cs b/Server/Services/ChatService.cs index 0ccdfe1f..04a41d6b 100644 --- a/Server/Services/ChatService.cs +++ b/Server/Services/ChatService.cs @@ -5,7 +5,7 @@ using System.Text; /** * @overview Life of German Reallife - Chat Service (ChatService.cs) -* @author hydrant +* @author hydrant, xSprite * @copyright (c) 2008 - 2018 Life of German */ @@ -22,5 +22,14 @@ namespace reallife_gamemode.Server.Services { player.SendChatMessage("~r~[FEHLER]~s~ Der Spieler wurde nicht gefunden."); } + + public static void PlayerNotLoggedIn(Client player) + { + player.SendChatMessage("~r~[FEHLER]~s~ Du bist nicht eingeloggt."); + } + public static void ErrorMsg(Client player) + { + player.SendChatMessage("~r~[FEHLER]~s~ Die Aktion wurde nicht ausgeführt."); + } } } diff --git a/Server/Util/AdminLevel.cs b/Server/Util/AdminLevel.cs index 8e201b63..37be0ba7 100644 --- a/Server/Util/AdminLevel.cs +++ b/Server/Util/AdminLevel.cs @@ -12,8 +12,6 @@ namespace reallife_gamemode.Server.Util { public enum AdminLevel : int { - - PLAYER, SUPPORTER, ADMIN diff --git a/meta.xml b/meta.xml index 3bcdf84f..493c28f3 100644 --- a/meta.xml +++ b/meta.xml @@ -2,4 +2,46 @@