If you need to spawn a vehicle on the server side, you can use CreateVehicleServerSetter()
, but the issue is that you need the vehicle type, but on the server there is no native to get it from a vehicle model.
In txAdmin this was initially "solved" by getting the vehicle class on the client and sending that to the server use it as a type when creating the vehicle. The logic used on the client is to check for the class on the vehClassNamesEnum
table and assuming automobile
for classes not on that table.
Later it was noticed that the server needs "type" instead of "class", and there is also no GetVehicleTypeFromName()
on the client.
To solve this issue, it was created a lookup table to fix mismatched types.
This gist shows how to generate that table.
This must be run every now and then since new vehicles are added to the game on new DLC releases.