qbcore-framework / qb-garages

Garage System Used With QB-Core :car:
GNU General Public License v3.0
48 stars 260 forks source link

[BUG] The change in parameter order for updateVehicle from qb-core default breaks any script depending on it. #251

Closed mikepauer closed 2 years ago

mikepauer commented 2 years ago

Describe the bug You have put properties in as parameter 5, while QB-core default and any scripts written for it expect plate as parameter 5.

To Reproduce Steps to reproduce the behavior: Using this script alone works fine, but any scripts that are hooking into the event based on qb-core default will give errors.

Expected behavior The event should match qb-core's parameter layout as close as possible.

Questions (please complete the following information):

Additional context It's because you changed the parameter order for the function that is saving the vehicle so it is different from qb-cores default. So anything written to call qb-cores is failing.

This is the current qb-core default: RegisterNetEvent('qb-garage:server:updateVehicle', function(state, fuel, engine, body, plate, garage, type, gang)

This is the one currently being used: RegisterNetEvent('qb-garage:server:updateVehicle', function(state, fuel, engine, body, properties, plate, garage, location, damage)

so anything hooking into it (or trying to call it) is expecting plate as parameter 5, while this and it's own parking call is passing properties as parameter 5, plate as parameter 6.

To fix this I changed the function declaration to RegisterNetEvent('qb-garage:server:updateVehicle', function(state, fuel, engine, body, plate, garage, location, gang, properties, damage)

And I updated the function call in the client script (line 298 approximately) to be: TriggerServerEvent('qb-garage:server:updateVehicle', 1, totalFuel, engineDamage, bodyDamage, plate, garageName, StoreParkinglotAccuratly and closestVec3 or nil, nil, properties, StoreDamageAccuratly and GetCarDamage(veh) or nil)

which makes it so the garage parking works, but also any other scripts that are hooking into it also work.

mikepauer commented 2 years ago

Wrong git :/ I feel dumb