diff --git a/Import/Newtonsoft.Json.dll b/Import/Newtonsoft.Json.dll
new file mode 100644
index 00000000..5d693bad
Binary files /dev/null and b/Import/Newtonsoft.Json.dll differ
diff --git a/ReallifeGamemode.Client/Gui/playerlist.ts b/ReallifeGamemode.Client/Gui/playerlist.ts
index 82673a71..743b4654 100644
--- a/ReallifeGamemode.Client/Gui/playerlist.ts
+++ b/ReallifeGamemode.Client/Gui/playerlist.ts
@@ -10,24 +10,24 @@ export default function playerList(globalData: GlobalData): void {
var pList;
mp.events.add("showPlayerlist", (playersJson) => {
- if (!globalData.InMenu) {
- if (playerlistBrowser === null) {
-
- playerlistBrowser = mp.browsers.new('package://assets/html/Playerlist/Tabliste.html');
- mp.gui.chat.activate(false);
- mp.gui.cursor.show(true, true);
- pList = JSON.parse(playersJson);
- pList.forEach((player) => {
- playerlistBrowser.execute(`ad_row('${JSON.stringify(player.Id)}','${JSON.stringify(player.Name)}',0,0,'${JSON.stringify(player.Ping)}');`);
- });
-
- } else {
- playerlistBrowser.destroy()
- playerlistBrowser = null;
- mp.gui.cursor.show(false, false);
- mp.gui.chat.activate(true);
- }
+
+ if (playerlistBrowser === null) {
+ playerlistBrowser.destroy()
+ playerlistBrowser = null;
+ globalData.InInput = false;
+ mp.gui.cursor.show(false, false);
+ mp.gui.chat.activate(true);
}
+ if (!globalData.InInput) {
+ globalData.InInput = true;
+ playerlistBrowser = mp.browsers.new('package://assets/html/Playerlist/Tabliste.html');
+ mp.gui.chat.activate(false);
+ mp.gui.cursor.show(true, true);
+ pList = JSON.parse(playersJson);
+ pList.forEach((player) => {
+ playerlistBrowser.execute(`ad_row('${JSON.stringify(player.Id)}','${JSON.stringify(player.Name)}',0,0,'${JSON.stringify(player.Ping)}');`);
+ });
+ }
});
mp.events.add("CEF:fetchPlayerList", () => {
diff --git a/ReallifeGamemode.Client/Gui/taximeter.ts b/ReallifeGamemode.Client/Gui/taximeter.ts
new file mode 100644
index 00000000..3259ba74
--- /dev/null
+++ b/ReallifeGamemode.Client/Gui/taximeter.ts
@@ -0,0 +1,75 @@
+import InputHelper from '../inputhelper';
+
+let browser: BrowserMp;
+let price: Number;
+
+let lastkilometer: Number = 0;
+let lastPrice: Number = 0;
+let totalPrice: Number = 0;
+var myVar;
+export default function taximeterInput(globalData: GlobalData) {
+ mp.events.add("CLIENT:setFarePrice", () => {
+ /*
+ var textBox = new InputHelper("Setzen Sie ihre Fahrtkosten [2 - 50 $/km]", globalData);
+ textBox.show();
+ textBox.getValue((data) => {
+ var amount = parseInt(data);
+ if (isNaN(amount)) {
+ mp.game.graphics.notify('~r~Du musst eine Nummer eingeben!');
+ return;
+ }
+ price = amount;
+ mp.events.callRemote("SERVER:setFare", amount);
+ });
+ }
+ */
+ mp.events.callRemote("SERVER:setFare", 60);
+ price = 60;
+ });
+
+ mp.events.add("CLIENT:startFare", () => {
+ browser = mp.browsers.new('package://assets/html/taximeter/index.html');
+ browser.execute(`setFarePrice('${price}');`)
+ myVar = setInterval(myTimer, 100);
+ });
+
+ function myTimer() {
+ mp.gui.chat.push("" + totalPrice);
+ //if (mp.players.local.vehicle.getNumberOfPassengers() == 0) return;
+ if (totalPrice == lastPrice) return;
+ let payPrice = +totalPrice - +lastPrice;
+ lastPrice = totalPrice;
+ mp.gui.chat.push("" + totalPrice);
+ mp.events.callRemote("SERVER:payFare", payPrice, lastkilometer);
+ }
+
+ mp.events.add("CEF:updateLastPrice", (price, lastkilometer1) => {
+ totalPrice = price
+ lastkilometer = lastkilometer1;
+ });
+
+
+ mp.events.add("CLIENT:startCustomerFare", (price1, km) => {
+ browser = mp.browsers.new('package://assets/html/taximeter/index.html');
+ browser.execute(`setFarePrice('${price1}');`);
+ browser.execute(`updateKilometer('${km}')`);
+
+ });
+
+ mp.events.add("CLIENT:updateFare", (km) => {
+ mp.gui.chat.push("" + lastkilometer)
+ browser.execute(`updateKilometer('${JSON.parse(km)}')`)
+ });
+
+
+ mp.events.add("CLIENT:cancelFareCustomer", () => { //for Customer
+ mp.events.callRemote("SERVER:cancelFareCustomer", lastPrice);
+ browser.destroy();
+ browser = null;
+ });
+
+ mp.events.add("CLIENT:cancelFare", () => { //for Taxidriver
+ browser.destroy();
+ browser = null;
+ });
+}
\ No newline at end of file
diff --git a/ReallifeGamemode.Client/assets/css/taximeter/main.css b/ReallifeGamemode.Client/assets/css/taximeter/main.css
new file mode 100644
index 00000000..ab83f6e1
--- /dev/null
+++ b/ReallifeGamemode.Client/assets/css/taximeter/main.css
@@ -0,0 +1,64 @@
+@font-face {
+ font-family: DS-Digital;
+ src: url(../../font/taximeter/DS-Digital.woff2) format("woff2"),url(../../font/taximeter/DS-Digital.woff) format("woff");
+ font-weight: 400;
+ font-style: normal
+}
+
+ body {
+ width: 640px
+}
+
+h4 {
+ margin: 0
+}
+
+.taximeter-company {
+ background-color: #171717;
+ max-width: 100%
+}
+
+.taximeter-company__header {
+ text-align: center;
+ padding: 0;
+ margin: 0;
+ font-size: 170%;
+ font-family: DS-Digital;
+ color: #ff0
+}
+
+.taximeter {
+ max-width: 100%;
+ height: 80px;
+ padding: 1em;
+ display: flex;
+ justify-content: space-between;
+ background-color: #171717
+}
+
+.taximeter-element {
+ margin: 3px;
+ width: 200px;
+ height: 50px
+}
+
+.taximeter-header {
+ font-size: 170%;
+ color: red;
+ font-family: DS-Digital
+}
+
+.taximeter-output {
+ height: 40px;
+ max-width: 100%;
+ margin: 0;
+ font-family: DS-Digital;
+ font-size: 250%;
+ color: red;
+ display: block
+}
+
+.taximeter-output__additional {
+ font-size: 70%
+}
+/*# sourceMappingURL=main.css.map */
diff --git a/ReallifeGamemode.Client/assets/font/taximeter/DS-Digital.woff b/ReallifeGamemode.Client/assets/font/taximeter/DS-Digital.woff
new file mode 100644
index 00000000..e7c822ea
Binary files /dev/null and b/ReallifeGamemode.Client/assets/font/taximeter/DS-Digital.woff differ
diff --git a/ReallifeGamemode.Client/assets/font/taximeter/DS-Digital.woff2 b/ReallifeGamemode.Client/assets/font/taximeter/DS-Digital.woff2
new file mode 100644
index 00000000..699f8565
Binary files /dev/null and b/ReallifeGamemode.Client/assets/font/taximeter/DS-Digital.woff2 differ
diff --git a/ReallifeGamemode.Client/assets/html/taximeter/index.html b/ReallifeGamemode.Client/assets/html/taximeter/index.html
new file mode 100644
index 00000000..a0c99ba4
--- /dev/null
+++ b/ReallifeGamemode.Client/assets/html/taximeter/index.html
@@ -0,0 +1,38 @@
+
+
+
+
+
+ Taximeter
+
+
+
+
+
+
+
+
+
+
diff --git a/ReallifeGamemode.Client/assets/js/taximeter/main.js b/ReallifeGamemode.Client/assets/js/taximeter/main.js
new file mode 100644
index 00000000..ef028291
--- /dev/null
+++ b/ReallifeGamemode.Client/assets/js/taximeter/main.js
@@ -0,0 +1,36 @@
+var lastKilometer = 0;
+var price;
+
+document.addEventListener('DOMContentLoaded', function () { });
+
+const TOTAL_PRICE = document.getElementById("taximeter-price");
+const PRICE_KM = document.getElementById("taximeter-price-kilometer");
+const KILOMETER = document.getElementById("taximeter-kilometer");
+
+function updateKilometer(km) {
+ UpdateTotalPrice();
+ KILOMETER.innerHTML = (Math.round((lastKilometer + Number.EPSILON) * 1000) / 1000).toString();
+}
+
+
+function UpdateTotalPrice() {
+ var TotalPrice = +lastKilometer * + price;
+ console.log(+lastKilometer * + price);
+ TOTAL_PRICE.innerHTML = Math.floor(TotalPrice).toString();
+ //mp.trigger("CEF:updateLastPrice", Math.floor(TotalPrice), Math.round((lastKilometer + Number.EPSILON) * 1000) / 1000);
+}
+
+function updateFarePrice() {
+ document.getElementById("taximeter-price-kilometer").innerHTML = price.toString();
+ document.getElementById("taximeter-kilometer").innerHTML = "-";
+ document.getElementById("taximeter-price").innerHTML = "0";
+}
+
+function setFarePrice(price1) {
+ price = price1;
+ updateFarePrice();
+}
+
+
+
+
diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts
index 316cbc8c..ca47b675 100644
--- a/ReallifeGamemode.Client/index.ts
+++ b/ReallifeGamemode.Client/index.ts
@@ -188,4 +188,7 @@ import clotheShopList from './Interaction/clothes/ClotheShop';
clotheShopList(globalData);
import itemShopList from './Interaction/ItemShop';
-itemShopList(globalData);
\ No newline at end of file
+itemShopList(globalData);
+
+import taximeterInput from './Gui/taximeter';
+taximeterInput(globalData);
\ No newline at end of file
diff --git a/ReallifeGamemode.Client/inventory/inventory.ts b/ReallifeGamemode.Client/inventory/inventory.ts
index fc8e7118..895b3224 100644
--- a/ReallifeGamemode.Client/inventory/inventory.ts
+++ b/ReallifeGamemode.Client/inventory/inventory.ts
@@ -10,7 +10,6 @@ export default function inventory(globalData: GlobalData): void {
var ivehArr;
-
var Players;
mp.events.add('setVehiclesInventory', (vehInvArr) => {
@@ -23,33 +22,23 @@ export default function inventory(globalData: GlobalData): void {
});
var open = false;
mp.events.add('inventoryShow', (iWeight, iNameArr, iAmountArr, iIdArr, playersArr) => {
- if (!globalData.InMenu) {
- globalData.InMenu = true;
- if (invBrowser === null) {
-
-
- mp.gui.cursor.show(true, true);
- invBrowser = mp.browsers.new('package://assets/html/inventory/inventory.html');
- Players = playersArr;
- itemIdArr = iIdArr;
- itemAmountArr = iAmountArr;
- itemNameArr = iNameArr;
- invWeight = iWeight;
-
- } else {
-
- try {
- invBrowser.destroy()
- invBrowser = null;
- globalData.InMenu = false;
- }
- finally {
- mp.gui.cursor.show(false, false);
- }
- return;
-
- }
+ if (invBrowser !== null) {
+ invBrowser.destroy()
+ invBrowser = null;
+ globalData.InInput = false;
+ mp.gui.cursor.show(false, false);
+ return;
}
+ if (!globalData.InInput) {
+ globalData.InInput = true;
+ mp.gui.cursor.show(true, true);
+ invBrowser = mp.browsers.new('package://assets/html/inventory/inventory.html');
+ Players = playersArr;
+ itemIdArr = iIdArr;
+ itemAmountArr = iAmountArr;
+ itemNameArr = iNameArr;
+ invWeight = iWeight;
+ }
});
var offer = 0;
diff --git a/ReallifeGamemode.Database/Entities/JobVehicle.cs b/ReallifeGamemode.Database/Entities/JobVehicle.cs
index 8a66bdad..712fa83a 100644
--- a/ReallifeGamemode.Database/Entities/JobVehicle.cs
+++ b/ReallifeGamemode.Database/Entities/JobVehicle.cs
@@ -1,6 +1,6 @@
namespace ReallifeGamemode.Database.Entities
{
- public partial class JobVehicle : ServerVehicle
+ public partial class JobVehicle : ServerVehicle
{
public int JobId { get; set; }
}
diff --git a/ReallifeGamemode.Database/ReallifeGamemode.Database.csproj b/ReallifeGamemode.Database/ReallifeGamemode.Database.csproj
index 9d3eb1cc..ab543c94 100644
--- a/ReallifeGamemode.Database/ReallifeGamemode.Database.csproj
+++ b/ReallifeGamemode.Database/ReallifeGamemode.Database.csproj
@@ -23,6 +23,9 @@
..\Import\Bootstrapper.dll
+
+ ..\Import\Newtonsoft.Json.dll
+
diff --git a/ReallifeGamemode.Server/Extensions/VehicleExtension.cs b/ReallifeGamemode.Server/Extensions/VehicleExtension.cs
index 1b84094f..c6348c60 100644
--- a/ReallifeGamemode.Server/Extensions/VehicleExtension.cs
+++ b/ReallifeGamemode.Server/Extensions/VehicleExtension.cs
@@ -15,7 +15,7 @@ namespace ReallifeGamemode.Server.Extensions
public static Player GetDriver(this Vehicle veh)
{
- return NAPI.Pools.GetAllPlayers().Where(p => p.Vehicle.Handle == veh.Handle && p.VehicleSeat == -1).FirstOrDefault();
+ return NAPI.Pools.GetAllPlayers().Where(p => p.Vehicle.Handle == veh.Handle && p.VehicleSeat == 0).FirstOrDefault();
}
}
}
diff --git a/ReallifeGamemode.Server/Finance/Economy.cs b/ReallifeGamemode.Server/Finance/Economy.cs
index 63dad210..95b6ba27 100644
--- a/ReallifeGamemode.Server/Finance/Economy.cs
+++ b/ReallifeGamemode.Server/Finance/Economy.cs
@@ -187,9 +187,9 @@ namespace ReallifeGamemode.Server.Finance
dbContext.SaveChanges();
}
if (paycheck.Amount > 0)
- ChatService.SendMessage(client, "~g~[PAYDAY]~s~ Du hast einen Payday von ~g~$" + paycheck.Amount + "~s~ bekommen.");
+ ChatService.SendMessage(client, "~g~[PAYDAY]~s~ Dein Stundenumsatz beträgt + $~g~" + paycheck.Amount + "~s~.");
else
- ChatService.SendMessage(client, "~g~[PAYDAY]~s~ Du hast einen Payday von ~r~$" + paycheck.Amount + "~s~ bekommen.");
+ ChatService.SendMessage(client, "~g~[PAYDAY]~s~ Dein Stundenumsatz beträgt - $~r~" + paycheck.Amount + "~s~.");
}
diff --git a/ReallifeGamemode.Server/Job/JobBase.cs b/ReallifeGamemode.Server/Job/JobBase.cs
index ee7da34d..19262aa9 100644
--- a/ReallifeGamemode.Server/Job/JobBase.cs
+++ b/ReallifeGamemode.Server/Job/JobBase.cs
@@ -16,6 +16,7 @@ namespace ReallifeGamemode.Server.Job
public event JobStopHandler JobStop;
private readonly List _inJob = new List();
+ private static readonly List jobPlayer = new List();
public abstract int Id { get; }
@@ -27,6 +28,7 @@ namespace ReallifeGamemode.Server.Job
{
if (_inJob.Contains(player)) return;
_inJob.Add(player);
+ jobPlayer.Add(player);
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ gestartet.");
@@ -37,6 +39,7 @@ namespace ReallifeGamemode.Server.Job
{
if (!_inJob.Contains(player)) return;
_inJob.Remove(player);
+ jobPlayer.Remove(player);
if (quit)
{
@@ -54,6 +57,7 @@ namespace ReallifeGamemode.Server.Job
}
}
+ public static List GetPlayerInJob() => jobPlayer;
public List GetUsersInJob() => _inJob;
}
}
diff --git a/ReallifeGamemode.Server/Job/TaxiDriverJob.cs b/ReallifeGamemode.Server/Job/TaxiDriverJob.cs
index 909ac457..867aeae2 100644
--- a/ReallifeGamemode.Server/Job/TaxiDriverJob.cs
+++ b/ReallifeGamemode.Server/Job/TaxiDriverJob.cs
@@ -3,6 +3,14 @@ using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Server.Util;
+using ReallifeGamemode.Server.Services;
+using ReallifeGamemode.Server.Extensions;
+using System.Timers;
+using ReallifeGamemode.Database.Models;
+using ReallifeGamemode.Server.Managers;
+using ReallifeGamemode.Database.Entities;
+using System.Linq;
+using Newtonsoft.Json;
namespace ReallifeGamemode.Server.Job
{
@@ -10,26 +18,109 @@ namespace ReallifeGamemode.Server.Job
{
public List TaxiContracts { get; set; } = new List();
+ private static readonly Dictionary lastPositions = new Dictionary();
+
public override int Id => 1;
public override string Name => "Taxifahrer";
public override bool NeedVehicleToStart => true;
+
+ private static TaxiDriverJob _Instance;
+
public TaxiDriverJob()
{
JobStart += TaxiDriverJobJobStart;
JobStop += TaxiDriverJobJobStop;
}
+ public static TaxiDriverJob GetInstance()
+ {
+ if (_Instance == null)
+ _Instance = new TaxiDriverJob();
+ return _Instance;
+ }
private void TaxiDriverJobJobStart(Player player)
{
player.Vehicle.SetSharedData("vehicleTaxiLight", true);
+ player.TriggerEvent("CLIENT:setFarePrice");
}
private void TaxiDriverJobJobStop(Player player)
{
player.Vehicle.SetSharedData("vehicleTaxiLight", false);
+ int Id = player.GetUser().Id;
+ player.ResetData("DriverPrice");
+ Vehicle v = player.Vehicle;
+
+ foreach (Player occupant in v.Occupants)
+ {
+ occupant.TriggerEvent("CLIENT:cancelFare");
+ }
}
+
+ [RemoteEvent("SERVER:failedFarePrice")]
+ private void SrvEvent_failedFarePrice(Player player)
+ {
+ ChatService.ErrorMessage(player, "Bitte richtigen Wert eintragen");
+ TaxiDriverJobJobStop(player);
+ }
+
+ [RemoteEvent("SERVER:setFare")]
+ private void SrvEvent_setFare(Player player, int amount)
+ {
+ player.SetData("DriverPrice", amount);
+ player.TriggerEvent("CLIENT:startFare");
+ }
+
+ [RemoteEvent("SERVER:payFare")]
+ private void SrvEvent_payFare(Player player, int amount, float km)
+ {
+ int id = player.GetUser().Id;
+ player.SetData("FareKm", km);
+ int targetId = player.GetData("Passager");
+ if (targetId == 0) return;
+ using (var dbContext = new DatabaseContext())
+ {
+ User target = dbContext.Users.Where(u => u.Id == targetId).FirstOrDefault();
+ target.Handmoney -= amount;
+ dbContext.SaveChanges();
+ target.Player.TriggerEvent("SERVER:SET_HANDMONEY", target.Handmoney);
+ }
+
+ }
+
+ public static void StartTaxiTimer()
+ {
+ Timer timer = new Timer(1000);
+ timer.Start();
+ timer.Elapsed += UpdateFare;
+ }
+
+ private static void UpdateFare(object sender, ElapsedEventArgs e)
+ {
+ foreach(var player in GetPlayerInJob())
+ {
+ if (!player.HasData("hasPassager")) { player.SetData("hasPassager", false); continue; }
+ int playerId = player.GetUser().Id;
+
+ Vehicle v = player.Vehicle;
+
+ Vector3 lastPosition = v.Position;
+ if (lastPositions.ContainsKey(v.Handle)) lastPosition = lastPositions[v.Handle];
+ lastPositions[v.Handle] = v.Position;
+
+ double distance = lastPosition.DistanceTo(v.Position) / 1000.0;
+ if (distance > 0.5) { ChatService.BroadcastAdmin($"Möglicher Cheater - {player.Name}", Database.AdminLevel.MAPPING); continue; }
+ if (!player.GetData("hasPassager")) continue;
+ foreach (Player occupant in v.Occupants)
+ {
+ occupant.TriggerEvent("CLIENT:updateFare", JsonConvert.SerializeObject(distance));
+ }
+
+ }
+ }
+
}
}
diff --git a/ReallifeGamemode.Server/Main.cs b/ReallifeGamemode.Server/Main.cs
index 11a6b502..6c0e0370 100644
--- a/ReallifeGamemode.Server/Main.cs
+++ b/ReallifeGamemode.Server/Main.cs
@@ -8,6 +8,7 @@ using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.Wanted;
using ReallifeGamemode.Server.DrivingSchool;
using ReallifeGamemode.Server.WeaponDeal;
+using ReallifeGamemode.Server.Job;
/**
* @overview Life of German Reallife - Main Class (Main.cs)
@@ -60,6 +61,7 @@ namespace ReallifeGamemode.Server
ATMManager.InitATMs();
CityHallManager.LoadCityHall();
JobManager.LoadJobs();
+ TaxiDriverJob.StartTaxiTimer();
HouseManager.LoadHouses();
DrivingSchool.DrivingSchool.Setup();
PlaneSchool.Setup();
diff --git a/ReallifeGamemode.Server/Managers/JobManager.cs b/ReallifeGamemode.Server/Managers/JobManager.cs
index 0c8f41a5..b6617594 100644
--- a/ReallifeGamemode.Server/Managers/JobManager.cs
+++ b/ReallifeGamemode.Server/Managers/JobManager.cs
@@ -14,7 +14,7 @@ using System.Reflection;
namespace ReallifeGamemode.Server.Managers
{
- class JobManager : Script
+ public class JobManager : Script
{
private static List _jobs = new List();
@@ -30,9 +30,8 @@ namespace ReallifeGamemode.Server.Managers
throw new InvalidOperationException($"Double Job ID found: {instance.Id} | {instance.Name}");
}
_jobs.Add(instance);
- NAPI.Util.ConsoleOutput($"Loading job {instance.Name}");
+ NAPI.Util.ConsoleOutput($"Loading job {instance.Name}");
}
-
NAPI.Util.ConsoleOutput($"Loaded {_jobs.Count} jobs");
}
@@ -218,28 +217,64 @@ namespace ReallifeGamemode.Server.Managers
[ServerEvent(Event.PlayerEnterVehicle)]
public void JobManagerPlayerEnterVehicle(Player player, Vehicle veh, sbyte seat)
{
+ if (seat == 0) return;
ServerVehicle sVeh = veh.GetServerVehicle();
if (sVeh == null) return;
if (sVeh is JobVehicle jV && jV.JobId == 1) // Spieler steigt in Taxi ein
{
var taxiJob = JobManager.GetJob();
+ Player driver = veh.GetDriver();
+ if (!driver.HasData("DriverPrice")) return;
+ int taxiPrice = driver.GetData("DriverPrice");
+
+ float km = 0;
+ if (!driver.HasData("FareKm")) { driver.SetData("FareKm", km); }
+ km = driver.GetData("FareKm");
+ if (driver.HasData("Passager")) return;
+ driver.SetData("Passager", player.GetUser().Id);
+ driver.SetData("hasPassager", true);
+
+ player.TriggerEvent("CLIENT:startCustomerFare", taxiPrice, km);
+
var taxiContracts = taxiJob.TaxiContracts.Where(t => t.Name == player.Name);
if (taxiContracts.Count() == 0) return;
var contract = taxiContracts.First();
taxiJob.TaxiContracts.Remove(contract);
- Player driver = veh.GetDriver();
-
- if (driver != null && contract.Driver.Handle != veh.GetDriver().Handle)
+ if (driver != null && contract.Driver != null && contract.Driver.Handle != veh.GetDriver().Handle)
{
ChatService.SendMessage(contract.Driver, $"!{{02FCFF}}{player.Name} ist in ein Taxi eingestiegen, der Auftrag wurde beendet.");
ChatService.SendMessage(player, $"!{{02FCFF}}Du bist in ein Taxi eingestiegen, der Auftrag wurde beendet.");
+ }
+ }
+ }
+
+ [ServerEvent(Event.PlayerExitVehicle)]
+ public void JobManagerPlayerEnterVehicle(Player player, Vehicle veh)
+ {
+ ServerVehicle sVeh = veh.GetServerVehicle();
+ if (sVeh == null) return;
+ if (sVeh is JobVehicle jV && jV.JobId == 1) // Spieler steigt in Taxi aus
+ {
+ var taxiJob = JobManager.GetJob();
+ if (veh.Occupants.Count == 0) return;
+ Player driver = veh.GetDriver();
+ if (driver == null) return;
+ if (player.GetUser().Id != driver.GetData("Passager")) { player.TriggerEvent("CLIENT:cancelFare"); return; }
+ player.TriggerEvent("CLIENT:cancelFareCustomer");
+ driver.ResetData("Passager");
+ driver.ResetData("hasPassager");
+ foreach(Player occupant in veh.Occupants)
+ {
+ if (occupant == driver) continue;
+ occupant.WarpOutOfVehicle();
}
}
}
+
[RemoteEvent("CLIENT:JobManager_TaxiJob_AcceptCall")]
public void TaxiJobAcceptCall(Player player, string name)
{
@@ -264,8 +299,10 @@ namespace ReallifeGamemode.Server.Managers
job.Driver = player;
player.TriggerEvent("SERVER:Util_setWaypoint", target.Position.X, target.Position.Y);
+ player.SetData("hasPassager", true);
ChatService.SendMessage(target, $"!{{02FCFF}}Dein Auftrag wurde von {player.Name} angenommen. Warte an deiner aktuellen Position.");
+ ChatService.SendMessage(target, $"!{{02FCFF}}Für die Anfahrt fallen zusätzlich Kosten auf.");
ChatService.SendMessage(player, $"!{{02FCFF}}Du hast den Auftrag von {name} angenommen. Hole ihn nun ab.");
}
}
diff --git a/ReallifeGamemode.Server/ReallifeGamemode.Server.csproj b/ReallifeGamemode.Server/ReallifeGamemode.Server.csproj
index b7a1737d..7d6bff0f 100644
--- a/ReallifeGamemode.Server/ReallifeGamemode.Server.csproj
+++ b/ReallifeGamemode.Server/ReallifeGamemode.Server.csproj
@@ -34,6 +34,9 @@
..\Import\Bootstrapper.dll
+
+ ..\Import\Newtonsoft.Json.dll
+
diff --git a/ReallifeGamemode.Server/Util/TaxiContract.cs b/ReallifeGamemode.Server/Util/TaxiContract.cs
index c96b5e37..e3794840 100644
--- a/ReallifeGamemode.Server/Util/TaxiContract.cs
+++ b/ReallifeGamemode.Server/Util/TaxiContract.cs
@@ -5,7 +5,7 @@ using System.Text;
namespace ReallifeGamemode.Server.Util
{
- class TaxiContract
+ public class TaxiContract
{
public string Name { get; set; }
diff --git a/ReallifeGamemode.Services/ReallifeGamemode.Services.csproj b/ReallifeGamemode.Services/ReallifeGamemode.Services.csproj
index 4283d21d..a62c6b53 100644
--- a/ReallifeGamemode.Services/ReallifeGamemode.Services.csproj
+++ b/ReallifeGamemode.Services/ReallifeGamemode.Services.csproj
@@ -11,6 +11,9 @@
..\Import\Bootstrapper.dll
+
+ ..\Import\Newtonsoft.Json.dll
+