GetVehicleComponentInSlot bug with bullbars and bumpers
#1

Hi all,

The bug is that front bullbars and front bumpers have the same slot: CARMODTYPE_FRONT_BUMPER. The same goes for rear bullbars and rear bumpers: CARMODTYPE_REAR_BUMPER. This can bug in GetVehicleComponentInSlot, as you can have both bullbar and bumper components installed at the same time, but the function will only return the last installed one. Detecting if the other one is installed, is impossible.

A small showcase to reproduce this bug:
If you do this, while "vehid" refers to a vehicle with a Slamvan model:
pawn Код:
AddVehicleComponent(vehid, 1117); // Installs Chrome Bumper for Slamvan.
AddVehicleComponent(vehid, 1115); // Installs Chrome Bullbars for Slamvan.
Both items will be visible on the Slamvan.

But now, if you do this a while later:
pawn Код:
new compid = GetVehicleComponentInSlot(vehid, CARMODTYPE_FRONT_BUMPER);
printf("Front bumper component ID: %i", compid);
This will print "Front bumper component ID: 1115", which are the Bullbars.

Now if you this, instead of the above code:
pawn Код:
AddVehicleComponent(vehid, 1115); // Installs Chrome Bullbars for Slamvan
AddVehicleComponent(vehid, 1117); // Installs Chrome Bumper for Slamvan

new compid = GetVehicleComponentInSlot(vehid, CARMODTYPE_FRONT_BUMPER);
printf("Front bumper component ID: %i", compid);
Both will be visible, but now "Front bumper component ID: 1117" will now be printed in the console, which is the Bumper.

It will only remember the last installed one. This while both items are still on the vehicle, "using" the same slot. The same happens for rear bullbars and rear bumpers: you can have two items installed at the same time, but they still "use" the same slot.

If I may suggest a solution: add two extra slots to GetVehicleComponentInSlot. One for the front bullbars and one for the rear bullbars. Save the front bullbars in their "front bullbar" slot, instead of saving them in the CARMODTYPE_FRONT_BUMPER slot. Same goes for the rear bullbars: save them in a "rear bullbar" slot, instead of CARMODTYPE_REAR_BUMPER.

Would be awesome if this could be fixed.
Thanks in advance!

Regards,
Basssiiie
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)