From 05a95dcb86a5d19da41b4167526901f577ea546d Mon Sep 17 00:00:00 2001 From: Siga Date: Fri, 13 Mar 2020 14:53:49 +0100 Subject: [PATCH] Taximeter fix clientside --- ReallifeGamemode.Client/Gui/taximeter.ts | 4 ---- ReallifeGamemode.Client/Player/keys.ts | 2 +- ReallifeGamemode.Client/assets/js/taximeter/main.js | 4 ++-- ReallifeGamemode.Client/index.ts | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/ReallifeGamemode.Client/Gui/taximeter.ts b/ReallifeGamemode.Client/Gui/taximeter.ts index 3259ba74..38c9a06f 100644 --- a/ReallifeGamemode.Client/Gui/taximeter.ts +++ b/ReallifeGamemode.Client/Gui/taximeter.ts @@ -34,12 +34,9 @@ export default function taximeterInput(globalData: GlobalData) { }); 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); } @@ -57,7 +54,6 @@ export default function taximeterInput(globalData: GlobalData) { }); mp.events.add("CLIENT:updateFare", (km) => { - mp.gui.chat.push("" + lastkilometer) browser.execute(`updateKilometer('${JSON.parse(km)}')`) }); diff --git a/ReallifeGamemode.Client/Player/keys.ts b/ReallifeGamemode.Client/Player/keys.ts index 79deaee0..745eaad5 100644 --- a/ReallifeGamemode.Client/Player/keys.ts +++ b/ReallifeGamemode.Client/Player/keys.ts @@ -139,7 +139,7 @@ export default function keys(globalData: GlobalData) { } }); - //2 // Job Starten + //J // Job Starten mp.keys.bind(0x4A, false, () => { if (!globalData.InChat && !globalData.InInput && !globalData.InMenu && globalData.LoggedIn) { mp.events.callRemote("CLIENT:JobManager_ShowJobMenu"); diff --git a/ReallifeGamemode.Client/assets/js/taximeter/main.js b/ReallifeGamemode.Client/assets/js/taximeter/main.js index ef028291..9eb00b8a 100644 --- a/ReallifeGamemode.Client/assets/js/taximeter/main.js +++ b/ReallifeGamemode.Client/assets/js/taximeter/main.js @@ -8,6 +8,7 @@ const PRICE_KM = document.getElementById("taximeter-price-kilometer"); const KILOMETER = document.getElementById("taximeter-kilometer"); function updateKilometer(km) { + lastKilometer = +lastKilometer + +km; UpdateTotalPrice(); KILOMETER.innerHTML = (Math.round((lastKilometer + Number.EPSILON) * 1000) / 1000).toString(); } @@ -15,9 +16,8 @@ function updateKilometer(km) { 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); + mp.trigger("CEF:updateLastPrice", Math.floor(TotalPrice), Math.round((lastKilometer + Number.EPSILON) * 1000) / 1000); } function updateFarePrice() { diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index 9e1b4e05..c532a7a3 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -167,7 +167,7 @@ import smoothThrottle from './vehiclesync/smoothtrottle'; smoothThrottle(); import vehicleIndicators from './vehiclesync/vehicleindicators'; -vehicleIndicators(); +vehicleIndicators(); import reportList from './Player/reportmenu'; reportList(globalData);