Merged 'develop' into feature
This commit is contained in:
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
@@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
* @overview Life of German Reallife - Login Login login.html
|
* @overview Life of German Reallife - Client Login login.html
|
||||||
* @author Orangebox, hydrant, VegaZ
|
* @author Orangebox, hydrant, VegaZ
|
||||||
* @copyright (c) 2008 - 2018 Life of German
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
*-->
|
*-->
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<script src="Dependences/jquery-3.3.1.min.js"></script>
|
<script src="../Dependences/jquery-3.3.1.min.js"></script>
|
||||||
<link rel="stylesheet" href="style.css" />
|
<link rel="stylesheet" href="style.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
33
Client/Save/main.js
Normal file
33
Client/Save/main.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* @overview Life of German Reallife - Save Main main.js
|
||||||
|
* @author VegaZ
|
||||||
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
|
*/
|
||||||
|
var saveBrowser;
|
||||||
|
|
||||||
|
mp.events.add('saveBlip', () => {
|
||||||
|
|
||||||
|
saveBrowser = mp.browsers.new('package://Save/save.html');
|
||||||
|
mp.gui.chat.activate(false);
|
||||||
|
mp.gui.cursor.show(true, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add('saveData', (blipSprite, blipName, blipScale, blipColor, blipAlpha, blipDrawDistance, blipShortRange, blipRotation, blipDimension) => {
|
||||||
|
if (saveBrowser) {
|
||||||
|
saveBrowser.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
mp.events.callRemote('OnSaveBlipData', blipSprite, blipName, blipScale, blipColor, blipAlpha,
|
||||||
|
blipDrawDistance, blipShortRange, blipRotation, blipDimension);
|
||||||
|
mp.gui.chat.push(blipShortRange);
|
||||||
|
mp.gui.cursor.show(false, false);
|
||||||
|
mp.gui.chat.activate(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add('cancelData', () => {
|
||||||
|
if (saveBrowser) {
|
||||||
|
saveBrowser.destroy();
|
||||||
|
}
|
||||||
|
mp.gui.cursor.show(false, false);
|
||||||
|
mp.gui.chat.activate(true);
|
||||||
|
});
|
||||||
72
Client/Save/save.html
Normal file
72
Client/Save/save.html
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<!--
|
||||||
|
* @overview Life of German Reallife - Client Save.html
|
||||||
|
* @author Orangebox, hydrant, VegaZ
|
||||||
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
|
*-->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<script src="../Dependences/jquery-3.3.1.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="style.css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="save-page" style="padding: 5% 0 0;">
|
||||||
|
<div class="form">
|
||||||
|
<div class="blip-form">
|
||||||
|
<p><b>Blip speichern, bitte fülle die Tabelle aus:</b></p>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td align="right"><b>Model ID:</b></td>
|
||||||
|
<td><input type="text" placeholder="[INT]-Wert" id="blipSprite" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right"><b>Name:</b></td>
|
||||||
|
<td><input type="text" placeholder="Wird angezeigt beim hovern" id="blipName" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right"><b>Skalierung:</b></td>
|
||||||
|
<td><input type="text" placeholder="[FLOAT]-Wert | Standard: 1" id="blipScale" /></td>
|
||||||
|
</tr>
|
||||||
|
<!--<tr>
|
||||||
|
<td align="right"><b>Farbe:</b></td>
|
||||||
|
<td>
|
||||||
|
<input class="colorPicker" type="color" id="blipColor" name="blipColor" value="#000000" />
|
||||||
|
</td>
|
||||||
|
</tr>-->
|
||||||
|
<tr>
|
||||||
|
<td align="right"><b>Farbe:</b></td>
|
||||||
|
<td><input type="text" placeholder="Siehe Wiki" id="blipColor" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right"><b>Transparenz:</b></td>
|
||||||
|
<td><input type="text" placeholder="(0-255)" id="blipAlpha" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right"><b>Draw Distance:</b></td>
|
||||||
|
<td><input type="text" placeholder="[FLOAT]-Wert" id="blipDrawDistance" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right"><b>Short Range:</b></td>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" id="blipShortRange" name="blipShortRange" value="shortRange" />Zeigt das Blip nur innerhalb der Minimap
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right"><b>Rotation:</b></td>
|
||||||
|
<td><input type="text" placeholder="[FLOAT]-Wert" id="blipRotation" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right"><b>Dimension:</b></td>
|
||||||
|
<td><input type="text" placeholder="(0-255)" id="blipDimension" /></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<button id="saveBtn" onclick="saveData()">Speichern</button><br /><br />
|
||||||
|
<button class="cancelBtn" onclick="cancelData()">Abbrechen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="save.js" type="text/javascript"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
28
Client/Save/save.js
Normal file
28
Client/Save/save.js
Normal file
@@ -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;
|
||||||
|
}
|
||||||
184
Client/Save/style.css
Normal file
184
Client/Save/style.css
Normal file
@@ -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;
|
||||||
|
}
|
||||||
@@ -4,4 +4,6 @@
|
|||||||
* @copyright (c) 2008 - 2018 Life of German
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require('./Login/main.js');
|
require('./Login/main.js');
|
||||||
|
require('./Save/main.js');
|
||||||
|
require('./Save/save.js');
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Configuration;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - DatabaseContext.cs
|
* @overview Life of German Reallife - DatabaseContext.cs
|
||||||
@@ -37,5 +39,12 @@ namespace reallife_gamemode.Model
|
|||||||
public DbSet<Server.Entities.Faction> Factions { get; set; }
|
public DbSet<Server.Entities.Faction> Factions { get; set; }
|
||||||
public DbSet<Server.Entities.FactionRank> FactionRanks { get; set; }
|
public DbSet<Server.Entities.FactionRank> FactionRanks { get; set; }
|
||||||
public DbSet<Server.Entities.User> Users { get; set; }
|
public DbSet<Server.Entities.User> Users { get; set; }
|
||||||
|
|
||||||
|
public DbSet<Server.Saves.SavedBlip> Blips { get; set; }
|
||||||
|
public DbSet<Server.Saves.SavedMarker> Markers { get; set; }
|
||||||
|
public DbSet<Server.Saves.SavedPed> Peds { get; set; }
|
||||||
|
public DbSet<Server.Saves.SavedPickup> Pickups { get; set; }
|
||||||
|
public DbSet<Server.Saves.SavedTextLabel> TextLabels { get; set; }
|
||||||
|
public DbSet<Server.Saves.SavedVehicle> Vehicles { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using reallife_gamemode.Model;
|
using reallife_gamemode.Model;
|
||||||
using reallife_gamemode.Server.Entities;
|
using reallife_gamemode.Server.Entities;
|
||||||
|
using reallife_gamemode.Server.Events;
|
||||||
using reallife_gamemode.Server.Extensions;
|
using reallife_gamemode.Server.Extensions;
|
||||||
using reallife_gamemode.Server.Services;
|
using reallife_gamemode.Server.Services;
|
||||||
using reallife_gamemode.Server.Util;
|
using reallife_gamemode.Server.Util;
|
||||||
@@ -46,7 +45,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
player.SendChatMessage("~r~[FEHLER]~s~ Du sitzt momentan schon in einem Fahrzeug.");
|
player.SendChatMessage("~r~[FEHLER]~s~ Du sitzt momentan schon in einem Fahrzeug.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vehicle v = NAPI.Vehicle.CreateVehicle(hash, player.Position, player.Rotation.Z, color1, color2);
|
Vehicle v = NAPI.Vehicle.CreateVehicle(hash, player.Position, player.Rotation.Z, color1, color2);
|
||||||
|
|
||||||
player.SetIntoVehicle(v.Handle, -1);
|
player.SetIntoVehicle(v.Handle, -1);
|
||||||
@@ -102,7 +101,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
|
|
||||||
Client target = ClientService.GetClientByName(name);
|
Client target = ClientService.GetClientByName(name);
|
||||||
|
|
||||||
if(target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
ChatService.PlayerNotFound(player);
|
ChatService.PlayerNotFound(player);
|
||||||
return;
|
return;
|
||||||
@@ -153,13 +152,13 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
option = option.ToLower();
|
option = option.ToLower();
|
||||||
|
|
||||||
if(option == "load")
|
if (option == "load")
|
||||||
{
|
{
|
||||||
NAPI.World.RequestIpl(name);
|
NAPI.World.RequestIpl(name);
|
||||||
player.SendChatMessage("~g~Das IPL ~s~" + name + " ~g~wurde erfolgreich geladen");
|
player.SendChatMessage("~g~Das IPL ~s~" + name + " ~g~wurde erfolgreich geladen");
|
||||||
}
|
}
|
||||||
else if(option == "remove")
|
else if (option == "remove")
|
||||||
{
|
{
|
||||||
NAPI.World.RemoveIpl(name);
|
NAPI.World.RemoveIpl(name);
|
||||||
player.SendChatMessage("~g~Das IPL ~s~" + name + " ~g~wurde erfolgreich entladen");
|
player.SendChatMessage("~g~Das IPL ~s~" + name + " ~g~wurde erfolgreich entladen");
|
||||||
@@ -194,7 +193,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
|
|
||||||
WeaponHash wHash = NAPI.Util.WeaponNameToModel(weapon);
|
WeaponHash wHash = NAPI.Util.WeaponNameToModel(weapon);
|
||||||
|
|
||||||
if(wHash == default(WeaponHash))
|
if (wHash == default(WeaponHash))
|
||||||
{
|
{
|
||||||
player.SendChatMessage("~r~[FEHLER]~s~ Diese Waffe existiert nicht.");
|
player.SendChatMessage("~r~[FEHLER]~s~ Diese Waffe existiert nicht.");
|
||||||
return;
|
return;
|
||||||
@@ -241,7 +240,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
Entities.Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == faction);
|
Entities.Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == faction);
|
||||||
if(f == null && faction != 0)
|
if (f == null && faction != 0)
|
||||||
{
|
{
|
||||||
player.SendChatMessage("~r~[FEHLER]~s~ Diese Fraktion existiert nicht (Liste: ~m~/factionlist).");
|
player.SendChatMessage("~r~[FEHLER]~s~ Diese Fraktion existiert nicht (Liste: ~m~/factionlist).");
|
||||||
return;
|
return;
|
||||||
@@ -249,7 +248,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
|
|
||||||
User u = dbContext.Users.SingleOrDefault(x => x.Name == target.Name);
|
User u = dbContext.Users.SingleOrDefault(x => x.Name == target.Name);
|
||||||
|
|
||||||
if(faction != 0)
|
if (faction != 0)
|
||||||
{
|
{
|
||||||
u.FactionId = f.Id;
|
u.FactionId = f.Id;
|
||||||
u.FactionRankId = dbContext.FactionRanks.
|
u.FactionRankId = dbContext.FactionRanks.
|
||||||
@@ -270,5 +269,29 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command("save", "~m~Benutzung: ~s~/save [Typ = ~g~Blip, ~r~Marker, Ped, Pickup, TextLabel, ~g~Vehicle")]
|
||||||
|
public void CmdAdminSave(Client player, string typ)
|
||||||
|
{
|
||||||
|
switch (typ)
|
||||||
|
{
|
||||||
|
case "Blip":
|
||||||
|
player.TriggerEvent("saveBlip");
|
||||||
|
break;
|
||||||
|
case "Ped":
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
78
Server/Events/SaveData.cs
Normal file
78
Server/Events/SaveData.cs
Normal file
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
44
Server/Managers/LoadManager.cs
Normal file
44
Server/Managers/LoadManager.cs
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
38
Server/Saves/SavedBlip.cs
Normal file
38
Server/Saves/SavedBlip.cs
Normal file
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
39
Server/Saves/SavedMarker.cs
Normal file
39
Server/Saves/SavedMarker.cs
Normal file
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
28
Server/Saves/SavedPed.cs
Normal file
28
Server/Saves/SavedPed.cs
Normal file
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
32
Server/Saves/SavedPickup.cs
Normal file
32
Server/Saves/SavedPickup.cs
Normal file
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
38
Server/Saves/SavedTextLabel.cs
Normal file
38
Server/Saves/SavedTextLabel.cs
Normal file
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Server/Saves/SavedVehicle.cs
Normal file
36
Server/Saves/SavedVehicle.cs
Normal file
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
42
meta.xml
42
meta.xml
@@ -2,4 +2,46 @@
|
|||||||
<meta>
|
<meta>
|
||||||
<info name="reallife-gamemode" type="script" />
|
<info name="reallife-gamemode" type="script" />
|
||||||
<script src="reallife-gamemode.dll" />
|
<script src="reallife-gamemode.dll" />
|
||||||
|
|
||||||
|
<!--CS-->
|
||||||
|
|
||||||
|
<!--Model-->
|
||||||
|
<script src="Model/DatabaseContext.cs" type="server" lang="chsarp" />
|
||||||
|
|
||||||
|
<!--Server-->
|
||||||
|
|
||||||
|
<!--Commands-->
|
||||||
|
<script src="Server/Commands/Admin.cs" type="server" lang="csharp" />
|
||||||
|
|
||||||
|
<!--Entities-->
|
||||||
|
<script src="Server/Entities/User.cs" type="server" lang="csharp" />
|
||||||
|
|
||||||
|
<!--Events-->
|
||||||
|
<script src="Server/Events/Connect.cs" type="server" lang="csharp" />
|
||||||
|
<script src="Server/Events/Death.cs" type="server" lang="csharp" />
|
||||||
|
<script src="Server/Events/Login.cs" type="server" lang="csharp" />
|
||||||
|
<script src="Server/Events/Register.cs" type="server" lang="csharp" />
|
||||||
|
<script src="Server/Events/SaveData.cs" type="server" lang="csharp" />
|
||||||
|
<script src="Server/Events/Spawn.cs" type="server" lang="csharp" />
|
||||||
|
|
||||||
|
<!--Extensions-->
|
||||||
|
<script src="Server/Extensions/ClientExtension.cs" type="server" lang="csharp" />
|
||||||
|
|
||||||
|
<!--Managers-->
|
||||||
|
<script src="Server/Managers/LoadManager.cs" type="server" lang="csharp" />
|
||||||
|
|
||||||
|
<!--Saves-->
|
||||||
|
<script src="Server/Saves/SavedBlip.cs" type="server" lang="csharp" />
|
||||||
|
<script src="Server/Saves/SavedMarker.cs" type="server" lang="csharp" />
|
||||||
|
<script src="Server/Saves/SavedPed.cs" type="server" lang="csharp" />
|
||||||
|
<script src="Server/Saves/SavedPickup.cs" type="server" lang="csharp" />
|
||||||
|
<script src="Server/Saves/SavedTextLabel.cs" type="server" lang="csharp" />
|
||||||
|
<script src="Server/Saves/SavedVehicle.cs" type="server" lang="csharp" />
|
||||||
|
|
||||||
|
<!--Services-->
|
||||||
|
<script src="Server/Services/ChatService.cs" type="server" lang = "csharp" />
|
||||||
|
<script src="Server/Services/ClientService.cs" type="server" lang="csharp" />
|
||||||
|
|
||||||
|
<!--Util-->
|
||||||
|
<script src="Server/Util/AdminLevel.cs" type="server" lang="csharp" />
|
||||||
</meta>
|
</meta>
|
||||||
Reference in New Issue
Block a user