Taximeter fix clientside
This commit is contained in:
@@ -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)}')`)
|
||||
});
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user