Fix for null veh data in rent timer
This commit is contained in:
@@ -41,14 +41,16 @@ function initTimers() {
|
|||||||
|
|
||||||
function vehicleRentCheck() {
|
function vehicleRentCheck() {
|
||||||
for(let i in getServerData().vehicles) {
|
for(let i in getServerData().vehicles) {
|
||||||
if(getServerData().vehicles[i].rentPrice > 0) {
|
if(getServerData().vehicles[i] != null) {
|
||||||
if(getServerData().vehicles[i].rentedBy) {
|
if(getServerData().vehicles[i].rentPrice > 0) {
|
||||||
let rentedBy = getServerData().vehicles[i].rentedBy;
|
if(getServerData().vehicles[i].rentedBy) {
|
||||||
if(getClientData(rentedBy).cash < getServerData().vehicles[i].rentPrice) {
|
let rentedBy = getServerData().vehicles[i].rentedBy;
|
||||||
messageClientAlert(rentedBy, `You do not have enough money to continue renting this vehicle!`);
|
if(getClientData(rentedBy).cash < getServerData().vehicles[i].rentPrice) {
|
||||||
stopRentingVehicle(rentedBy);
|
messageClientAlert(rentedBy, `You do not have enough money to continue renting this vehicle!`);
|
||||||
} else {
|
stopRentingVehicle(rentedBy);
|
||||||
getClientData(rentedBy).cash -= getServerData().vehicles[i].rentPrice;
|
} else {
|
||||||
|
getClientData(rentedBy).cash -= getServerData().vehicles[i].rentPrice;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user