Full Example
A complete client and server example that registers a custom interaction using every field type and reads the values back.
This example registers a custom interaction type called dummy_full that uses every field type, then
reads the configured values back on the client when a player uses the point.
Server
Register the type and its fields.
local status, errorMessage = exports['hex_jobscreator']:registerInteraction({
name = 'dummy_full',
label = 'Dummy Full Showcase',
data = {
{
name = 'title',
label = 'Title',
type = 'text',
required = true,
placeholder = 'Enter a title…',
description = 'A short headline.',
},
{
name = 'amount',
label = 'Amount',
type = 'number',
required = true,
min = 1,
max = 100,
default = 10,
description = 'How many? (1–100)',
},
{
name = 'enabled',
label = 'Enabled',
type = 'checkbox',
default = true,
description = 'Toggle this feature on or off.',
},
{
name = 'category',
label = 'Category',
type = 'select',
required = true,
options = {
{ value = 'alpha', label = 'Alpha' },
{ value = 'beta', label = 'Beta' },
{ value = 'gamma', label = 'Gamma' },
},
default = 'alpha',
description = 'Pick a category.',
},
{
name = 'accent',
label = 'Accent Colour',
type = 'color',
default = '#DB5A44',
description = 'Choose a highlight colour.',
hasColorPicker = true
},
{ name = 'wasd', label = 'Items', type = 'itemlist', hasPicker = true },
{ name = 'guns', label = 'Weapons', type = 'weaponlist', hasPicker = true },
{ name = 'vehicles', label = 'Vehicles', type = 'vehiclelist', hasPicker = true },
{ name = 'money', label = 'Accounts', type = 'accountlist', hasPicker = true },
}
})
if not status then
print('^1[DUMMY] registerInteraction (full): ' .. tostring(errorMessage) .. '^7')
else
print('^2[DUMMY] Registered "dummy_full" successfully.^7')
endClient
Listen for the interaction and read the values staff configured on that point.
RegisterNetEvent('hex_jobscreator:creator:processInteraction', function(interactionType, interactionId, is2Job, interactionData)
if interactionType ~= 'dummy_full' then return end
if not interactionData or not next(interactionData) then return end
print('Custom API recieved interaction:', interactionData.title)
print('Enabled:', interactionData.enabled)
print('Amount:', interactionData.amount)
print('Category:', interactionData.category)
print('Accent:', json.encode(interactionData.accent))
print('Accounts:', json.encode(interactionData.money))
print('Weapons:', json.encode(interactionData.guns))
print('Items:', json.encode(interactionData.gear))
print('Vehicles:', json.encode(interactionData.vehicles))
end)Reading the values
Each field arrives under the name you gave it in data. Colour fields arrive as a table, and the
four entry lists arrive as arrays see
Field Types for the exact shapes.