> For the complete documentation index, see [llms.txt](https://alt0.gitbook.io/alt0-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alt0.gitbook.io/alt0-docs/alt0-networks/developers.md).

# For developers

Read networks and check connections from your own scripts.

## Client

```lua
local networks = exports['alt0-networks']:getNearbyNetworks()
-- strongest first: { id, ssid, bssid, strength (0-100), secured, bandwidth, uplink, encryptionLevel }
```

## Server

```lua
-- add or remove a network while the server runs
exports['alt0-networks']:registerNetwork({
    id = 'my_net', coords = vec3(x, y, z), radius = 40.0,
    ssid = 'MyNet', secured = true, passkey = 'secret',
})
exports['alt0-networks']:removeNetwork('my_net')

-- who has really connected (with a passkey or a hack)
exports['alt0-networks']:hasAccess(playerId, 'my_net')
exports['alt0-networks']:isSessionValid(token, playerId, 'my_net')
exports['alt0-networks']:grantTemporaryAccess('my_net', playerId, 300) -- seconds

-- change a network's range for a while
exports['alt0-networks']:addSignalModifier('my_net', {
    id = 'x', type = 'jammer', magnitude = 0.5, expires = os.time() + 60,
})
```

## Connecting from a client script

```lua
local result = lib.callback.await('alt0:server:attemptConnect', false, networkId, 'passkey', { key = '...' })
```

Use `'hack'` instead of `'passkey'` after your own minigame. The player must carry one of `hacking.requiredItems`.

## Another inventory

The items go through `bridge/inventory.lua`, which tries ox\_inventory, qs-inventory, qb-inventory and then the QBCore or ESX player inventory. To use another inventory, add it to the `Count`, `Remove` and `Add` functions there.
