Framework
Framework copied to clipboard
Vehicles are not identified uniquely
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
- Create two vehicles with the same pid and plate.
- Unimpound one vehicle.
- Destroy the vehicle.
- Wait for cleanup.fsm doing its job (normally all 3 minutes).
- Restart server.
- Now both vehicles are deleted from database.
or
- Create two vehicles with the same pid and plate.
- Unimpound one vehicle.
- Add some items to the inventory of the vehicle.
- Check the database: Both vehicles have now the same inventory.
or
- Create two vehicles with the same pid and plate.
- Unimpound one vehicle.
- Damage vehicle.
- Impound vehicle.
- 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
It's 1 in a Million that you have the Same plate with the Same PID
We are talking about Vehicles, nothing dramatic
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)
change it so the plate inst the unique identifier, instead its the id in the database. works great for us.
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
We've started using a gangID col in the players tablet that is then used to get the gang. It works perfectly fine.
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