sign-posts-wrenchAPI/Events/Exports

Developer API – Space Trucker

If you want to create scripts that interact with Space Trucker (for example: a web dashboard, a custom XP system, or usable items), use the Exports and Events below.


Server-Side Exports

GetFullCompanyData(companyId)

Returns a complete table containing all company data.

local data = exports['space_trucker']:GetFullCompanyData(1)

print(data.company_data.name)    -- Company name
print(data.company_data.balance) -- Company balance

-- Also returns:
-- data.employees     (table)
-- data.fleet         (table)
-- data.transactions  (table)

GetPlayer(source)

Helper function to retrieve the player object, regardless of framework (ESX or QBCore, as long as the bridge is correctly set).


CheckIfPlayerWorksForCompany(source)

Quickly checks whether a player is employed by any company.


AddIndustry(...)

Adds a new industry dynamically, without editing the script files.

This is useful for:

  • Procedural maps

  • Dynamic events

  • Temporary industries


Client-Side Events

space_trucker:client:startMission

Triggers the visual start of a mission for the player.

  • Parameters:

    • missionData (table)


space_trucker:client:openTablet

Forces the company tablet to open.

Common use cases:

  • Usable items (inventory exports)

  • NPC interactions

  • External UI triggers


Server-Side Events

space_trucker:server:missionCompleted

Triggered whenever a contract mission is completed.

This event can be listened to by other scripts to grant XP, rewards, or progression.


💡 Integration Ideas

  • Battle Pass / Skill progression

  • Web dashboards (company analytics)

  • Custom achievements

  • Economy trackers

  • RP-based contracts and story events

Last updated