Exports (client)#
Enable#
Enable/disable automatic saving of vehicles for a client.
Parameters:
enable - bool - true to enable, false to disable
UpdateVehicle#
Allows manually updating a vehicle if necessary. Bypasses all blacklist checks and can be used to save new vehicles as well.
Parameters:
vehicle - int - Vehicle handle.
DeleteVehicle#
Deletes a vehicle from the world and the internal data so that it doesn't respawn.
Parameters:
vehicle - int - Vehicle handle.
keepInWorld? - bool - If the vehicle should stay in the world. Defaults to false.
DeleteVehicleOnServer#
Delete a vehicle without having access to the entity directly. At least one of the first three parameters must be provided.
Parameters:
identifier? - string - The unique identifier provided by AdvancedParking.
networkId? - int - Vehicle network id.
plate? - string - Vehicle license plate text.
keepInWorld? - bool - If the vehicle should stay in the world. Defaults to false.
local identifier = Entity(vehicle).state.ap_id
local networkId = NetworkGetNetworkIdFromEntity(vehicle)
local plate = GetVehicleNumberPlateText(vehicle)
exports["AdvancedParking"]:DeleteVehicleOnServer(identifier, networkId, plate)
GetVehiclePosition#
Returns the position of a single vehicle. If vehicle is present on client side this will get the position directly. If not present, it will check server side similar to the server side export.
Parameters:
plate - string - Vehicle license plate text.
Returns:
vector3? - Position of the vehicle or nil.
GetVehiclePositions#
Returns the positions of several given vehicles. If vehicle is present on client side this will get the position directly. If not present, it will check server side similar to the server side export.
Parameters:
plates - table<string> - Table containing license plates (not case sensitive) (checks full
and trimmed plate).
Returns:
dictionary<string, vector3> - Positions of the vehicles by plate. Can be empty if none was found.
local plateList = { plate1, plate2, plate3 }
local positions = exports["AdvancedParking"]:GetVehiclePositions(plateList)
for plate, position in pairs(positions) do
print(plate, tostring(position))
end
UpdatePlate#
Updates a plate in AdvancedParking's data. This is necessary when changing a saved vehicle's
plate so that it doesn't get caught by one of the error protection systems. Ideally this should
replace calls to SetVehicleNumberPlateText.
Parameters:
vehicle - int - Vehicle handle.
newPlate - string - New plate to set.
FreezeVehicle#
Freezes (or unfreezes) a vehicle. This is intended to be used from the fixFreezeEntity.lua but
can be used when the file cannot be used. Can only be executed when using the
forceUnfreezeVehicles config option.
Parameters:
vehicle - int - Vehicle handle.
freeze - boolean - true for freezing, false for unfreezing.