22.03.2017, 20:27
You can use SetVehicleParamsForPlayer for all forbidden vehicles when the player chooses team to lock the vehicle, instead of everytime the player tries to enter a vehicle.
Other than that, to my knowledge; the only way to really do this without checking all of the vehicles is to distinguish unique features that the team vehicles have. This will really depend on how your gamemode is running.
For instance, if only team one can use vehicle model ID 400, then you could use GetVehicleModel to detect whether they are entering a forbidden vehicle and eject them.
Alternatively, you could also possibly use SetVehicleParamsEx to assign a unique feature then use GetVehicleParamsEx to check what team the vehicle belongs to. [For example, the alarm parameter could be used for team one, whislt the objective parameter could be used for team two] I wouldn't really recommend this though as it could cause conflict if you are using these functions for other purposes.
Other than that, to my knowledge; the only way to really do this without checking all of the vehicles is to distinguish unique features that the team vehicles have. This will really depend on how your gamemode is running.
For instance, if only team one can use vehicle model ID 400, then you could use GetVehicleModel to detect whether they are entering a forbidden vehicle and eject them.
Alternatively, you could also possibly use SetVehicleParamsEx to assign a unique feature then use GetVehicleParamsEx to check what team the vehicle belongs to. [For example, the alarm parameter could be used for team one, whislt the objective parameter could be used for team two] I wouldn't really recommend this though as it could cause conflict if you are using these functions for other purposes.