Merge branch 'feature/atm-system' into 'develop'
Commit for testing on Linux OS See merge request log-gtav/reallife-gamemode!9
This commit is contained in:
10
ReallifeGamemode.Client/Interaction/worldinteraction.js
Normal file
10
ReallifeGamemode.Client/Interaction/worldinteraction.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
mp.events.add("SERVER:ShowAtmUi", (atmId, atmBalance) => {
|
||||||
|
mp.gui.cursor.show(true, true);
|
||||||
|
mp.gui.chat.show(false);
|
||||||
|
mp.game.ui.displayHud(false);
|
||||||
|
mp.game.ui.displayRadar(false);
|
||||||
|
|
||||||
|
atmBrowser = mp.browsers.new("package://assets/html/atm/index.html");
|
||||||
|
});
|
||||||
@@ -26,21 +26,21 @@ mp.keys.bind(0x25, false, function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//UP ARROW (Interaktion mit anderen Spielern)
|
//UP ARROW (Interaktion mit Spielwelt)
|
||||||
mp.keys.bind(0x26, false, function () {
|
//mp.keys.bind(0x26, false, function () {
|
||||||
if (!globalData.InChat && !showInv && !globalData.Interaction) {
|
// if (!globalData.InChat && !showInv && !globalData.Interaction) {
|
||||||
mp.events.callRemote("keyPress:UP_ARROW");
|
// mp.events.callRemote("keyPress:UP_ARROW");
|
||||||
}
|
// }
|
||||||
});
|
//});
|
||||||
|
|
||||||
//RIGHT ARROW (Interaktion mit anderen Spielern)
|
//RIGHT ARROW (Fraktionsinteraktion)
|
||||||
mp.keys.bind(0x27, false, function () {
|
mp.keys.bind(0x27, false, function () {
|
||||||
if (!globalData.InChat && !showInv && !globalData.Interaction) {
|
if (!globalData.InChat && !showInv && !globalData.Interaction) {
|
||||||
mp.events.callRemote("keyPress:RIGHT_ARROW");
|
mp.events.callRemote("keyPress:RIGHT_ARROW");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//DOWN ARROW (Interaktion mit anderen Spielern)
|
//DOWN ARROW (Eigeninteraktion)
|
||||||
mp.keys.bind(0x28, false, function () {
|
mp.keys.bind(0x28, false, function () {
|
||||||
if (!globalData.InChat && !showInv && !globalData.Interaction) {
|
if (!globalData.InChat && !showInv && !globalData.Interaction) {
|
||||||
mp.events.callRemote("keyPress:DOWN_ARROW");
|
mp.events.callRemote("keyPress:DOWN_ARROW");
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Folder Include="assets\css\atm\" />
|
||||||
|
<Folder Include="assets\img\atm\" />
|
||||||
<Folder Include="cs_packages\" />
|
<Folder Include="cs_packages\" />
|
||||||
<Folder Include="Gui\vehiclemenu\web\css\" />
|
<Folder Include="Gui\vehiclemenu\web\css\" />
|
||||||
<Folder Include="Gui\vehiclemenu\web\font\" />
|
<Folder Include="Gui\vehiclemenu\web\font\" />
|
||||||
|
|||||||
12
ReallifeGamemode.Client/assets/html/atm/index.html
Normal file
12
ReallifeGamemode.Client/assets/html/atm/index.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="package://assets/css/atm/style.css" />
|
||||||
|
<link rel="stylesheet" href="package://assets/css/jquery-ui.min.css" />
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript" src="package://assets/js/jquery-3.3.1.min.js"></script>
|
||||||
|
<script type="text/javascript" src="package://assets/js/jquery-ui.min.js"></script>
|
||||||
|
<script type="text/javascript" src="package://assets/js/login/script.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -25,6 +25,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
{
|
{
|
||||||
public class Admin : Script
|
public class Admin : Script
|
||||||
{
|
{
|
||||||
|
#region Test
|
||||||
[Command("eat", "~m~Benutzung: ~s~/eat [Item]")]
|
[Command("eat", "~m~Benutzung: ~s~/eat [Item]")]
|
||||||
public void CmdAdminEat(Client player, string item)
|
public void CmdAdminEat(Client player, string item)
|
||||||
{
|
{
|
||||||
@@ -57,6 +58,58 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command("myvehicles")]
|
||||||
|
public void CmdAdminMyVehicles(Client player)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
player.SendChatMessage("Deine Fahrzeuge: ");
|
||||||
|
|
||||||
|
int userID = player.GetUser().Id;
|
||||||
|
using (var loadData = new DatabaseContext())
|
||||||
|
{
|
||||||
|
foreach (UserVehicle v in loadData.UserVehicles)
|
||||||
|
{
|
||||||
|
if (v.UserId == userID)
|
||||||
|
{
|
||||||
|
player.SendChatMessage("~b~" + v.Model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO
|
||||||
|
[Command("fpay")]
|
||||||
|
public void FPay(Client player, string receiver, int amount)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
using (var getFaction = new DatabaseContext())
|
||||||
|
{
|
||||||
|
Entities.Faction receiverUser = getFaction.Factions.FirstOrDefault(u => u.Name == receiver);
|
||||||
|
|
||||||
|
if (receiverUser == null)
|
||||||
|
{
|
||||||
|
player.SendChatMessage("~r~[FEHLER]~s~ Diese Fraktion existiert nicht.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BankManager.TransferMoney(player.GetUser(), receiverUser, amount, "/FPAY");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("saveall")]
|
||||||
|
public void SaveAll(Client player)
|
||||||
|
{
|
||||||
|
SaveManager.SaveAllOnSave();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
#region Support
|
#region Support
|
||||||
[Command("o", "~m~Benutzung: ~s~/o [Nachricht]", GreedyArg = true)]
|
[Command("o", "~m~Benutzung: ~s~/o [Nachricht]", GreedyArg = true)]
|
||||||
public void CmdAdminO(Client player, string message)
|
public void CmdAdminO(Client player, string message)
|
||||||
@@ -221,8 +274,6 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region ALevel1
|
#region ALevel1
|
||||||
[Command("a", "~m~Benutzung: ~s~/a [Nachricht]", GreedyArg = true)]
|
[Command("a", "~m~Benutzung: ~s~/a [Nachricht]", GreedyArg = true)]
|
||||||
public void CmdAdminA(Client player, string message)
|
public void CmdAdminA(Client player, string message)
|
||||||
@@ -734,8 +785,6 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
player.Position = player.Position.Add(new Vector3(0, 0, 2));
|
player.Position = player.Position.Add(new Vector3(0, 0, 2));
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region ALevel2
|
#region ALevel2
|
||||||
[Command("sethp", "~m~Benutzung: ~s~/sethp [Spieler] (Hp)")]
|
[Command("sethp", "~m~Benutzung: ~s~/sethp [Spieler] (Hp)")]
|
||||||
public void CmdAdminSetHp(Client player, string name, int hp = 100)
|
public void CmdAdminSetHp(Client player, string name, int hp = 100)
|
||||||
@@ -808,8 +857,6 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
else player.Position = new Vector3(x, y, z);
|
else player.Position = new Vector3(x, y, z);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region ALevel3
|
#region ALevel3
|
||||||
|
|
||||||
[Command("veh", "~m~Benutzung: ~s~/veh [Fahrzeug] (Farbe 1) (Farbe 2)")]
|
[Command("veh", "~m~Benutzung: ~s~/veh [Fahrzeug] (Farbe 1) (Farbe 2)")]
|
||||||
@@ -1026,10 +1073,19 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
player.SendChatMessage("~b~Du hast die Rüstung von " + target.Name + " auf " + armor + " gesetzt.");
|
player.SendChatMessage("~b~Du hast die Rüstung von " + target.Name + " auf " + armor + " gesetzt.");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region ALevel1337
|
#region ALevel1337
|
||||||
|
|
||||||
|
[Command("quicksavemode", "~m~Benutzung: ~s~/quicksavemode [Modus]\nModi (klein schreiben): ~g~blip, ~r~atm")]
|
||||||
|
public void CmdAdminSetQuickSaveMode(Client player, string mode)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
player.SetData("quicksavemode", mode);
|
||||||
|
}
|
||||||
|
|
||||||
[Command("giveitem", "~m~Benutzung: ~s~/giveitem [Target] [Item ID] [Anzahl]")]
|
[Command("giveitem", "~m~Benutzung: ~s~/giveitem [Target] [Item ID] [Anzahl]")]
|
||||||
public void CmdAdminGiveItem(Client player, string targetname, int itemId, int amount)
|
public void CmdAdminGiveItem(Client player, string targetname, int itemId, int amount)
|
||||||
{
|
{
|
||||||
@@ -2225,7 +2281,6 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ALevel1338
|
#region ALevel1338
|
||||||
|
|
||||||
[Command("whitelist", "~m~Benutzung: ~s~/whitelist [Add / Remove] [Socialclub Name]")]
|
[Command("whitelist", "~m~Benutzung: ~s~/whitelist [Add / Remove] [Socialclub Name]")]
|
||||||
@@ -2311,60 +2366,5 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
/* ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */
|
|
||||||
|
|
||||||
//TEST COMMAND
|
|
||||||
[Command("myvehicles")]
|
|
||||||
public void CmdAdminMyVehicles(Client player)
|
|
||||||
{
|
|
||||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
|
||||||
{
|
|
||||||
ChatService.NotAuthorized(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
player.SendChatMessage("Deine Fahrzeuge: ");
|
|
||||||
|
|
||||||
int userID = player.GetUser().Id;
|
|
||||||
using (var loadData = new DatabaseContext())
|
|
||||||
{
|
|
||||||
foreach (UserVehicle v in loadData.UserVehicles)
|
|
||||||
{
|
|
||||||
if (v.UserId == userID)
|
|
||||||
{
|
|
||||||
player.SendChatMessage("~b~" + v.Model);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO
|
|
||||||
[Command("fpay")]
|
|
||||||
public void FPay(Client player, string receiver, int amount)
|
|
||||||
{
|
|
||||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
|
||||||
{
|
|
||||||
ChatService.NotAuthorized(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
using (var getFaction = new DatabaseContext())
|
|
||||||
{
|
|
||||||
Entities.Faction receiverUser = getFaction.Factions.FirstOrDefault(u => u.Name == receiver);
|
|
||||||
|
|
||||||
if(receiverUser == null)
|
|
||||||
{
|
|
||||||
player.SendChatMessage("~r~[FEHLER]~s~ Diese Fraktion existiert nicht.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BankManager.TransferMoney(player.GetUser(), receiverUser, amount, "/FPAY");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Command("saveall")]
|
|
||||||
public void SaveAll(Client player)
|
|
||||||
{
|
|
||||||
SaveManager.SaveAllOnSave();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
32
ReallifeGamemode.Server/Entities/ATM.cs
Normal file
32
ReallifeGamemode.Server/Entities/ATM.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using GTANetworkAPI;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @overview Life of German Reallife - Entities ATM (ATM.cs)
|
||||||
|
* @author VegaZ
|
||||||
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Entities
|
||||||
|
{
|
||||||
|
public class ATM
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int Balance { get; set; }
|
||||||
|
public float X { get; set; }
|
||||||
|
public float Y { get; set; }
|
||||||
|
public float Z { get; set; }
|
||||||
|
|
||||||
|
[NotMapped]
|
||||||
|
public Vector3 Position => new Vector3(X, Y, Z);
|
||||||
|
|
||||||
|
public bool Faulty { get; set; } = false;
|
||||||
|
public bool Active { get; set; } = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,14 +26,35 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
if (!player.IsLoggedIn()) return;
|
if (!player.IsLoggedIn()) return;
|
||||||
if (player.GetData("editmode") == true && player.GetUser().IsAdmin(AdminLevel.HEADADMIN) == true)
|
if (player.GetData("editmode") == true && player.GetUser().IsAdmin(AdminLevel.HEADADMIN) == true)
|
||||||
{
|
{
|
||||||
|
var saveMode = player.GetData("quicksavemode");
|
||||||
|
switch (saveMode)
|
||||||
|
{
|
||||||
|
case "none":
|
||||||
|
player.SendChatMessage("~r~Keinen Modus ausgewählt! ~y~/quicksavemode ~r~für mehr Infos!");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "blip":
|
||||||
TempBlip tempBlip = NAPI.Data.GetWorldData("blipTemplate");
|
TempBlip tempBlip = NAPI.Data.GetWorldData("blipTemplate");
|
||||||
SaveManager.OnSaveBlipData(player, tempBlip.Sprite.ToString(), tempBlip.Name, tempBlip.Scale.ToString(), tempBlip.Color.ToString(),
|
SaveManager.OnSaveBlipData(player, tempBlip.Sprite.ToString(), tempBlip.Name, tempBlip.Scale.ToString(), tempBlip.Color.ToString(),
|
||||||
tempBlip.Transparency.ToString(), 200.ToString(), tempBlip.ShortRange.ToString(), 0.ToString(), 0.ToString());
|
tempBlip.Transparency.ToString(), 200.ToString(), tempBlip.ShortRange.ToString(), 0.ToString(), 0.ToString());
|
||||||
player.SendNotification("~y~Blip~s~ erstellt!", false);
|
player.SendNotification("~y~Blip~s~ erstellt!", false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GroundItem.PickUpGroundItem(player);
|
GroundItem.PickUpGroundItem(player);
|
||||||
}
|
}
|
||||||
|
[RemoteEvent("keyPress:UP_ARROW")]
|
||||||
|
public void KeyPressUpArrow(Client player)
|
||||||
|
{
|
||||||
|
if (!player.IsLoggedIn()) return;
|
||||||
|
if (player.HasData("nearATM"))
|
||||||
|
{
|
||||||
|
ATMManager.ShowAtmUi(player, player.GetData("nearATM"));
|
||||||
|
}
|
||||||
|
}
|
||||||
[RemoteEvent("keyPress:LEFT_ARROW")]
|
[RemoteEvent("keyPress:LEFT_ARROW")]
|
||||||
public void KeyPressLeftArrow(Client player)
|
public void KeyPressLeftArrow(Client player)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
if (user.IsAdmin(AdminLevel.HEADADMIN) == true)
|
if (user.IsAdmin(AdminLevel.HEADADMIN) == true)
|
||||||
{
|
{
|
||||||
player.SetData("editmode", false);
|
player.SetData("editmode", false);
|
||||||
|
player.SetData("quicksavemode", "none");
|
||||||
}
|
}
|
||||||
|
|
||||||
var userBankAccount = loginUser.UserBankAccounts.SingleOrDefault(u => u.UserId == user.Id);
|
var userBankAccount = loginUser.UserBankAccounts.SingleOrDefault(u => u.UserId == user.Id);
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ namespace ReallifeGamemode.Server
|
|||||||
BusinessManager.LoadBusinesses();
|
BusinessManager.LoadBusinesses();
|
||||||
InteriorManager.LoadInteriors();
|
InteriorManager.LoadInteriors();
|
||||||
DoorManager.LoadDoors();
|
DoorManager.LoadDoors();
|
||||||
|
ATMManager.InitATMs();
|
||||||
|
|
||||||
|
|
||||||
TempBlip tempBlip = new TempBlip()
|
TempBlip tempBlip = new TempBlip()
|
||||||
|
|||||||
83
ReallifeGamemode.Server/Managers/ATMManager.cs
Normal file
83
ReallifeGamemode.Server/Managers/ATMManager.cs
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Server.Entities;
|
||||||
|
using ReallifeGamemode.Server.Models;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @overview Life of German Reallife - Managers ATMManager (ATMManager.cs)
|
||||||
|
* @author VegaZ
|
||||||
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Managers
|
||||||
|
{
|
||||||
|
public class ATMManager : Script
|
||||||
|
{
|
||||||
|
public static List<ColShape> ATMColShapes = new List<ColShape>();
|
||||||
|
|
||||||
|
public static void InitATMs()
|
||||||
|
{
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
foreach (var currentATM in dbContext.Blips)
|
||||||
|
{
|
||||||
|
if (currentATM.Sprite == 500)
|
||||||
|
{
|
||||||
|
if(dbContext.ATMs.FirstOrDefault(a => a.X == currentATM.PositionX && a.Y == currentATM.PositionY && a.Z == currentATM.PositionZ) == null)
|
||||||
|
{
|
||||||
|
var dataSet = new ATM
|
||||||
|
{
|
||||||
|
X = currentATM.PositionX,
|
||||||
|
Y = currentATM.PositionY,
|
||||||
|
Z = currentATM.PositionZ
|
||||||
|
};
|
||||||
|
dbContext.Add(dataSet);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
LoadATMs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void LoadATMs()
|
||||||
|
{
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
foreach (var currentATM in dbContext.ATMs)
|
||||||
|
{
|
||||||
|
var currentColShape = NAPI.ColShape.CreateCylinderColShape(new Vector3(currentATM.X, currentATM.Y, currentATM.Z), 2.5f, 3, 0);
|
||||||
|
currentColShape.OnEntityEnterColShape += EnterATMRange;
|
||||||
|
currentColShape.OnEntityExitColShape += ExitATMRange;
|
||||||
|
ATMColShapes.Add(currentColShape);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void EnterATMRange(ColShape colShape, Client client)
|
||||||
|
{
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
var nearATM = dbContext.ATMs.FirstOrDefault(a => a.X == colShape.Position.X && a.Y == colShape.Position.Y && a.Z == colShape.Position.Z);
|
||||||
|
client.SetData("nearATM", nearATM.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void ExitATMRange(ColShape colShape, Client client)
|
||||||
|
{
|
||||||
|
client.ResetData("nearATM");
|
||||||
|
}
|
||||||
|
public static void ShowAtmUi(Client player, int atmId)
|
||||||
|
{
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
var atmBalance = dbContext.ATMs.FirstOrDefault(a => a.Id == atmId);
|
||||||
|
player.TriggerEvent("SERVER:ShowAtmUi", atmId, atmBalance.Balance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
public class SaveManager : Script
|
public class SaveManager : Script
|
||||||
{
|
{
|
||||||
|
|
||||||
[RemoteEvent("OnSaveBlipData")]
|
[RemoteEvent("OnSaveBlipData")]
|
||||||
public static void OnSaveBlipData(Client player, string blipSprite, string blipName, string blipScale, string blipColor,
|
public static void OnSaveBlipData(Client player, string blipSprite, string blipName, string blipScale, string blipColor,
|
||||||
string blipAlpha, string blipDrawDistance, string blipShortRange, string blipRotation, string blipDimension)
|
string blipAlpha, string blipDrawDistance, string blipShortRange, string blipRotation, string blipDimension)
|
||||||
@@ -148,16 +149,6 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
// Alle Fahrzeuge
|
// Alle Fahrzeuge
|
||||||
using (var saveAll = new DatabaseContext())
|
using (var saveAll = new DatabaseContext())
|
||||||
{
|
{
|
||||||
foreach(ServerVehicle veh in saveAll.ServerVehicles)
|
|
||||||
{
|
|
||||||
Vehicle v = VehicleManager.GetVehicleFromServerVehicle(veh);
|
|
||||||
|
|
||||||
veh.PositionX = v.Position.X;
|
|
||||||
veh.PositionY = v.Position.Y;
|
|
||||||
veh.PositionZ = v.Position.Z;
|
|
||||||
veh.Heading = v.Heading;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Alle Spieler
|
//Alle Spieler
|
||||||
foreach (Client player in NAPI.Pools.GetAllPlayers())
|
foreach (Client player in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
@@ -168,6 +159,16 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
user.PositionZ = pos.Z;
|
user.PositionZ = pos.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (ServerVehicle veh in saveAll.ServerVehicles)
|
||||||
|
{
|
||||||
|
Vehicle v = VehicleManager.GetVehicleFromServerVehicle(veh);
|
||||||
|
|
||||||
|
veh.PositionX = v.Position.X;
|
||||||
|
veh.PositionY = v.Position.Y;
|
||||||
|
veh.PositionZ = v.Position.Z;
|
||||||
|
veh.Heading = v.Heading;
|
||||||
|
}
|
||||||
|
|
||||||
saveAll.SaveChanges();
|
saveAll.SaveChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1024
ReallifeGamemode.Server/Migrations/20190309184251_ATM.Designer.cs
generated
Normal file
1024
ReallifeGamemode.Server/Migrations/20190309184251_ATM.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
35
ReallifeGamemode.Server/Migrations/20190309184251_ATM.cs
Normal file
35
ReallifeGamemode.Server/Migrations/20190309184251_ATM.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Migrations
|
||||||
|
{
|
||||||
|
public partial class ATM : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "ATMs",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Balance = table.Column<int>(nullable: false),
|
||||||
|
X = table.Column<float>(nullable: false),
|
||||||
|
Y = table.Column<float>(nullable: false),
|
||||||
|
Z = table.Column<float>(nullable: false),
|
||||||
|
Faulty = table.Column<bool>(nullable: false),
|
||||||
|
Active = table.Column<bool>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_ATMs", x => x.Id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ATMs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,28 @@ namespace ReallifeGamemode.Migrations
|
|||||||
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
|
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||||
|
|
||||||
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.ATM", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<bool>("Active");
|
||||||
|
|
||||||
|
b.Property<int>("Balance");
|
||||||
|
|
||||||
|
b.Property<bool>("Faulty");
|
||||||
|
|
||||||
|
b.Property<float>("X");
|
||||||
|
|
||||||
|
b.Property<float>("Y");
|
||||||
|
|
||||||
|
b.Property<float>("Z");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("ATMs");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Ban", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Ban", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ namespace ReallifeGamemode.Server.Models
|
|||||||
public DbSet<Entities.Logs.Death> DeathLogs { get; set; }
|
public DbSet<Entities.Logs.Death> DeathLogs { get; set; }
|
||||||
|
|
||||||
//Saves
|
//Saves
|
||||||
|
public DbSet<Entities.ATM> ATMs { get; set; }
|
||||||
public DbSet<Entities.Saves.SavedBlip> Blips { get; set; }
|
public DbSet<Entities.Saves.SavedBlip> Blips { get; set; }
|
||||||
public DbSet<Entities.Door> Doors { get; set; }
|
public DbSet<Entities.Door> Doors { get; set; }
|
||||||
public DbSet<Entities.GotoPoint> GotoPoints { get; set; }
|
public DbSet<Entities.GotoPoint> GotoPoints { get; set; }
|
||||||
@@ -74,6 +75,7 @@ namespace ReallifeGamemode.Server.Models
|
|||||||
public DbSet<Entities.Saves.SavedVehicle> Vehicles { get; set; }
|
public DbSet<Entities.Saves.SavedVehicle> Vehicles { get; set; }
|
||||||
public DbSet<Entities.ShopVehicle> ShopVehicles { get; set; }
|
public DbSet<Entities.ShopVehicle> ShopVehicles { get; set; }
|
||||||
|
|
||||||
|
|
||||||
// Business
|
// Business
|
||||||
public DbSet<Entities.BusinessBankAccount> BusinessBankAccounts { get; set; }
|
public DbSet<Entities.BusinessBankAccount> BusinessBankAccounts { get; set; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user