From f6fac52b3d9ac3065725bdb7ce27b6341fff603d Mon Sep 17 00:00:00 2001 From: hydrant Date: Sun, 10 Mar 2019 15:10:40 +0100 Subject: [PATCH] Added waypoint to vehicle when buying --- ReallifeGamemode.Client/Gui/playerlist.html | 40 ------------------- ReallifeGamemode.Client/Gui/script.js | 8 ---- ReallifeGamemode.Client/Gui/style.css | 38 ------------------ ReallifeGamemode.Client/index.js | 2 + ReallifeGamemode.Client/util/waypoint.js | 3 ++ .../Managers/BusinessManager.cs | 7 ++-- 6 files changed, 9 insertions(+), 89 deletions(-) delete mode 100644 ReallifeGamemode.Client/Gui/playerlist.html delete mode 100644 ReallifeGamemode.Client/Gui/script.js delete mode 100644 ReallifeGamemode.Client/Gui/style.css create mode 100644 ReallifeGamemode.Client/util/waypoint.js diff --git a/ReallifeGamemode.Client/Gui/playerlist.html b/ReallifeGamemode.Client/Gui/playerlist.html deleted file mode 100644 index 27f3ec10..00000000 --- a/ReallifeGamemode.Client/Gui/playerlist.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - -
-
- - - - - - - - - -
ID
Name
Ping
-
- - - - \ No newline at end of file diff --git a/ReallifeGamemode.Client/Gui/script.js b/ReallifeGamemode.Client/Gui/script.js deleted file mode 100644 index 6e54688e..00000000 --- a/ReallifeGamemode.Client/Gui/script.js +++ /dev/null @@ -1,8 +0,0 @@ -$(document).ready(function () { - - mp.trig - - for (var player in pList) { - $("#playerData").append("" + player.Id + "" + player.Name + "" + player.Ping + ""); - } -}); \ No newline at end of file diff --git a/ReallifeGamemode.Client/Gui/style.css b/ReallifeGamemode.Client/Gui/style.css deleted file mode 100644 index d28c2277..00000000 --- a/ReallifeGamemode.Client/Gui/style.css +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @overview Life of German Reallife - Save CSS style.css - * @author Orangebox, hydrant, VegaZ - * @copyright (c) 2008 - 2018 Life of German - */ - -.playerlist { - background-color: rgba(61, 68, 87, 0.50); - position: absolute; - top: 50%; - left: 50%; - margin-right: -50%; - transform: translate(-50%, -50%); - min-width: 60%; - text-align: center; -} - -body { - font-family: "Roboto", sans-serif; - -webkit-font-smoothing: antialiased; - overflow: hidden; -} -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; - width: auto; -} - -table { - margin: auto; - align-self:center; - width: 100%; -} \ No newline at end of file diff --git a/ReallifeGamemode.Client/index.js b/ReallifeGamemode.Client/index.js index 5c794095..b43bf0d3 100644 --- a/ReallifeGamemode.Client/index.js +++ b/ReallifeGamemode.Client/index.js @@ -52,6 +52,8 @@ require('./Tuning/main.js'); require('./Tuning/sync.js'); require('./Tuning/sirensilence.js'); +require('./util/waypoint.js'); + require('./vehiclesync/vehiclesync.js'); require('./vehiclesync/smoothtrottle.js'); require('./vehiclesync/vehicleindicators.js'); \ No newline at end of file diff --git a/ReallifeGamemode.Client/util/waypoint.js b/ReallifeGamemode.Client/util/waypoint.js new file mode 100644 index 00000000..4428a5ee --- /dev/null +++ b/ReallifeGamemode.Client/util/waypoint.js @@ -0,0 +1,3 @@ +mp.events.add("SERVER:Util_setWaypoint", (x, y) => { + mp.game.ui.setNewWaypoint(x, y); +}); \ No newline at end of file diff --git a/ReallifeGamemode.Server/Managers/BusinessManager.cs b/ReallifeGamemode.Server/Managers/BusinessManager.cs index af67011a..ba2f43e0 100644 --- a/ReallifeGamemode.Server/Managers/BusinessManager.cs +++ b/ReallifeGamemode.Server/Managers/BusinessManager.cs @@ -127,7 +127,7 @@ namespace ReallifeGamemode.Server.Managers if (!(sVeh is ShopVehicle)) return; ShopVehicle shopVehicle = (ShopVehicle)sVeh; int price = shopVehicle.Price; - CarDealerBusinessBase business = (CarDealerBusinessBase)GetBusiness(shopVehicle.BusinessId); + CarDealerBusinessBase business = GetBusiness(shopVehicle.BusinessId) as CarDealerBusinessBase; TransactionResult result = BankManager.TransferMoney(player.GetUser(), business, price, "Auto gekauft"); if(result == TransactionResult.SENDER_NOT_ENOUGH_MONEY) { @@ -135,7 +135,9 @@ namespace ReallifeGamemode.Server.Managers return; } - Vector3 spawnPos = business.CarSpawnPositon; + Vector3 spawnPos = business.CarSpawnPositon.Around(3); + + player.TriggerEvent("SERVER:Util_setWaypoint", spawnPos.X, spawnPos.Y); UserVehicle newVeh = new UserVehicle { @@ -149,7 +151,6 @@ namespace ReallifeGamemode.Server.Managers PrimaryColor = 111, SecondaryColor = 111, Active = true, - NumberPlate = "" }; using(var dbContext = new DatabaseContext())