Framework icon indicating copy to clipboard operation
Framework copied to clipboard

Vehicles are not identified uniquely

Open baua1310 opened this issue 6 years ago • 7 comments

Expected behaviour

cleanup.fsm should only update alive status of one vehicle. fn_vehicleUpdate.sqf and fn_vehicleStore.sqf can update more than one vehicle.

Actual behaviour

If two or more vehicles have the same pid and plate both or more vehicles are updated.

Steps to reproduce the behaviour

  1. Create two vehicles with the same pid and plate.
  2. Unimpound one vehicle.
  3. Destroy the vehicle.
  4. Wait for cleanup.fsm doing its job (normally all 3 minutes).
  5. Restart server.
  6. Now both vehicles are deleted from database.

or

  1. Create two vehicles with the same pid and plate.
  2. Unimpound one vehicle.
  3. Add some items to the inventory of the vehicle.
  4. Check the database: Both vehicles have now the same inventory.

or

  1. Create two vehicles with the same pid and plate.
  2. Unimpound one vehicle.
  3. Damage vehicle.
  4. Impound vehicle.
  5. Check the database: Both vehicles have now the same damage.

Solution

Use id instead of combination of pid and plate, as id is the only unique key of vehicles database. Add id to "dbInfo" variable of vehicle.

Or make sure that plate and pid compination is unique.


Mission version: 5.0.0

baua1310 avatar Jan 21 '19 12:01 baua1310

It's 1 in a Million that you have the Same plate with the Same PID

VeratoxMC avatar Jan 21 '19 21:01 VeratoxMC

We are talking about Vehicles, nothing dramatic

VeratoxMC avatar Jan 22 '19 21:01 VeratoxMC

When it's inserting the vehicle into the database you could run a query to return all vehicles that have the same value as the _plate variable and if it returns anything exit, or I think you could just make the column a unique key (I don't know much about SQL at all)

pr-ophet avatar Feb 02 '19 17:02 pr-ophet

change it so the plate inst the unique identifier, instead its the id in the database. works great for us.

ConnerMerlin avatar Feb 02 '19 23:02 ConnerMerlin

The whole database structure of the framework is a petty mess... no usage of foreign keys, saving of members-Arrays instead of linking the gang to the player, redundancy at it's finest with steam64 id in literally EVERY table... yeah, so I guess before this (very unlikely to happen) "issue" is fixed the whole database structure should be overthought and reworked

blackfisch avatar Mar 04 '19 23:03 blackfisch

We've started using a gangID col in the players tablet that is then used to get the gang. It works perfectly fine.

Scarso327 avatar Mar 16 '19 12:03 Scarso327

We've started using a gangID col in the players tablet that is then used to get the gang. It works perfectly fine.

i can confirm that. working fine for us too. Problem is, that the repo has not implemented this up to this point I may be doing a rework some time

blackfisch avatar Mar 17 '19 22:03 blackfisch