Exports (server)

DeleteVehicle

Deletes a vehicle from the world and the internal table so that it doesn't respawn.

Parameters: vehicle - int - The vehicle to delete. keepInWorld? - bool - If the vehicle should stay in the world.

exports["AdvancedParking"]:DeleteVehicle(vehicle, false)


GetVehiclePosition

Returns the position of a single vehicle.

Parameters: plate - string - The license plate text of a vehicle.

Returns: vector3? - The position of the vehicle or nil.

local position = exports["AdvancedParking"]:GetVehiclePosition(plate)


GetVehiclePositions

Returns the positions of several given vehicles.

Parameters: ... - string - Variable number of license plates as arguments.

Returns: dictionary<string, vector3> - The positions of the vehicles. Can be empty if none was found.

local positions = GetVehiclePositions(plate1, plate2, plate3)
for plate, position in pairs(positions) do
    print(plate .. ": " .. tostring(position))
end


DeleteVehicleUsingData

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.

local identifier = Entity(vehicle).state.ap_id
local networkId = NetworkGetNetworkIdFromEntity(vehicle)
local plate = GetVehicleNumberPlateText(vehicle)

exports["AdvancedParking"]:DeleteVehicleUsingData(identifier, networkId, plate, true)


EnsureStateBag

Ensures that a specific state bag on an entity is saved by AdvancedParking.

Parameters: vehicle - int - The vehicle to check the state bag. bagKey - string - The key of the state bag to check for.

Returns: bool - true on success, false when e.g. state bag was missing

local success = exports["AdvancedParking"]:EnsureStateBag(vehicle, "fuel")


GetVehicleFromStateBagValue

Tries to find a vehicle that has a specific state bag value attached.

Parameters: bagKey - string - The key to search for. bagValue - any - The value to search for.

Returns: int? - The vehicle handle if a match was found.

local vehicle = exports["AdvancedParking"]:GetVehicleFromStateBagValue(bagKey, bagValue)


GetStateBagsFromVehicle

Gets all state bags from a vehicle that has been saved by AdvancedParking.

Parameters: vehicle - int - The vehicle handle.

Returns: dictionary<bagKey, bagValue> - A table containing all found state bag keys and values.

local stateBags = exports["AdvancedParking"]:GetStateBagsFromVehicle(vehicle)


GetStateBagsFromPlate

Gets all state bags from a vehicle that has been saved by AdvancedParking given its plate.

Parameters: plate - string - The vehicle's license plate text.

Returns: dictionary<bagKey, bagValue> - A table containing all found state bag keys and values.

local stateBags = exports["AdvancedParking"]:GetStateBagsFromPlate("KIMINAZE")

Last updated