@@ -629,21 +629,34 @@ function AddVehicleToGarage(source, vehicleName, plate, garage, props)
629629
630630 -- Generate plate if not provided
631631 if not plate or plate == " " then
632- plate = string.upper (ESX .Math .Trim (GetRandomNumber (1 ) .. GetRandomLetter (2 ) .. GetRandomNumber (3 ) .. GetRandomLetter (2 )))
632+ plate = string.upper (ESX .Math .Trim (math.random (1 , 9 ) .. math.random (00 ,99 ) .. math.random (1 , 9 ) .. math.random (00 ,99 )))
633+ end
634+ -- Just use props directly without modifying it
635+ -- If props is not a table with required fields, create proper structure
636+ if type (props ) ~= " table" then
637+ props = {}
638+ end
639+
640+ if not props .plate then
641+ props .plate = plate
633642 end
634643
635- local vehicleData = props or {model = vehicleName }
644+ if not props .model then
645+ props .model = GetHashKey (vehicleName )
646+ end
647+
648+ local vehicleData = props
636649 if type (vehicleData ) ~= " table" then vehicleData = {model = vehicleName } end
637650
638651 exports [' ata_core' ]:InsertSQL (" owned_vehicles" , {
639652 owner = playerIdentifier ,
640653 plate = plate ,
641654 vehicle = json .encode (vehicleData ),
642655 stored = 1 ,
643- garage_name = garage or " Central "
644- })
656+ parking = garage or " SanAndreasAvenue "
657+ })
645658
646- -- Set vehicle keys for ESX
659+ -- Set vehicle keys for ESX
647660 TriggerClientEvent (' esx_vehiclelock:setVehicleOwned' , source , plate )
648661
649662 return true , plate
0 commit comments