Stuyk/altv-athena

updateFuel() skip when vehicle is not created by athena.

gotgameio opened this issue · 0 comments

If updateFuel called for any vehicle not created with athena will get error:

[V8] Exception at server:resources/server/server/0.main.js:2500
[22:18:05][Error]       if (!isNaN(vehicle.data.fuel)) {
[22:18:05][Error]   TypeError: Cannot read property 'fuel' of undefined
at Object.updateFuel (resources/server/server/0.main.js:2500:29)
at handlePing (resources/server/server/0.main.js:3738:85)

Fix is simple:

server/extensions/vehicleFunctions/setter.ts:

function updateFuel(vehicle: alt.Vehicle) {
    // If vehicle is not created by athena skip it.
    if (!vehicle.data.uid) {
      return;
    }
    ....