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 - Valid vehicle handle.
DeleteVehicle#
Deletes a vehicle from the world and the internal data so that it doesn't respawn.
Parameters:
vehicle - int - The vehicle to delete.
keepInWorld? - bool - If the vehicle should stay in the world.
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 - The vehicle entity's network id.
plate? - string - The vehicles 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 - The license plate text of a vehicle.
Returns:
vector3? - The 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
plate and trimmed plate).
Returns:
dictionary<string, vector3> - The positions of the vehicles. 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.l
Parameters:
vehicle - int - Valid vehicle handle.
newPlate - string - The 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 - The vehicle handle.
freeze - boolean - true for freezing, false for unfreezing.