Skip to content

Exports & Events

Inventory use exports, custom diving payouts, and internal lobby events.

The resource registers four server exports for inventory item use. Activity menus communicate through net events and NUI callbacks; there is no general client export to open every activity.

Inventory exports#

ExportItems
useCanoecanoe
useWaterBoardpaddleboard, surfboard_sunset_ray, surfboard_sea_drifter, surfboard_lifeguard, surfboard_venice_02
useGroundGearroller_skates, skateboard, hoverboard
useUtilityVehiclesflatbed_hand_truck, palet_truck, rub_trolley

These use the ox_inventory server item callback signature (event, item, inventory). On usingItem, the resource validates the item/player, starts deployment, and returns false to stop the inventory's normal use flow. Do not treat them as unrestricted spawn functions.

Example item entry in ox_inventory/data/items.lua:

lua
['skateboard'] = {
    label = 'Skateboard',
    weight = 3800,
    stack = false,
    close = true,
    consume = 0,
    client = { image = 'nui://0r-activities/items/images/skateboard.png' },
    server = { export = '0r-activities.useGroundGear' }
},

Complete definitions are in install/ox_inventory.lua and install/qb_items.lua. Non-OX usable-item registration is handled through the selected QB/Qbox/ESX framework where available; other setups need their inventory's equivalent registration.

Custom diving payout#

Set these fields in config/diving.lua → rewards:

lua
rewards = {
    account = 'cash',
    customResource = 'my-economy',
    customExport = 'payActivity',
},

The receiving server export accepts (source, amount, account, reason):

lua
-- In my-economy/server.lua
exports('payActivity', function(source, amount, account, reason)
    -- Credit the player through your economy integration here.
    -- Return true only after payment succeeds; return false on failure.
    return false -- Replace after implementing the payout.
end)

reason is 'treasure-diving'. A configured, running custom resource is used before the built-in Qbox/QB/ESX payout. Return false or raise an error on failed payment so cargo remains eligible for retry. Leave both custom fields empty to use the framework bridge.

Lobby net events#

These are internal extension points. Preserve the built-in proximity, membership, capacity, and session checks when extending the menus.

Client → server prefix: 0r-activities:server:.

Event suffixArgumentsPurpose
createActivityLobbylobbyId, activity, selected, context?Create a group lobby / invite selected player IDs
respondActivityLobbyid, acceptedRespond to an existing invitation
setActivityLobbyDriverid, playerIdHost selects a driver from lobby members
startActivityLobbyidHost requests group launch
leaveActivityLobbyidLeave or close a lobby

lobbyId is the configured activity identifier; id is the numeric session ID returned by the server. Activity-specific contexts and identifiers are defined in server/activity_lobbies.lua.

Server → client prefix: 0r-activities:client:.

Event suffixArgumentsPurpose
activityLobbyInviteid, ownerName, title, timeoutInvitation; timeout is in seconds
activityLobbyStatestateMember list, roles, capacity, and start eligibility
activityLobbyClosedid, message, launchedLobby closes or hands off to an activity
notifymessage, notificationType?, durationMilliseconds?Show a notification through the selected backend

Example: observe lobby changes from another client resource:

lua
RegisterNetEvent('0r-activities:client:activityLobbyState', function(state)
    print(('Activity lobby %s: %d members'):format(state.id, #state.members))
end)