High Scripts

Documentation

Bridges

Here you will see examples and tutorials for bridges.

This documentation is still a work in progress. For now, use the existing bridges as reference points.

What are bridges?

Bridges are a way to support multiple other resources with ease. For example, High Phone supports not just one framework, but more than 5, including Standalone!

How does our bridge system work

Our bridge system automatically detects the used frameworks and resources and interconnects them.

For example, a framework has an addItem function for adding items, but ox_inventory overwrites these functions and has its own. To support the inventory, typically you would have to modify the framework bridge and add a bunch of if resourceState == 'started' then ... clauses.

Well fear not, you don't have to add a collection of if and else clauses, you can simply create a separate bridge file for that inventory system and make a function called addItem.

Our bridge system always gives priority to secondary resource functions, in the case of inventory bridges, first it checks if the inventory bridge contains a function called addItem. If it does not, it looks for the same function in the framework bridge and uses that.

While this may sound a little complicated, in a long term perspective, this is a way easier way to support third party resources, with a lot of flexibility!

Practical example

You can see how a vehicles bridge overrides the framework function.

bridges/server/vehicles/my_vehicles.lua
-- This is a vehicles bridge.
getVehicles = function(player)
    print("This will print, it overrides the framework's provided function.")
end
bridges/server/frameworks/my_framework.lua
-- This is a framework bridge.
getVehicles = function(player)
    print("This will not print, as it's overriden by the vehicles bridge.")
end

Last updated on

On this page