HeroHunt AppNew

HeroHunt App: Exports & Events

Admin commands, the player load events the HeroHunt App listens to, the framework bridges, the lb-phone integration and how to read its data.

v1.0.0Escrow protectedQBox · QBCore · ESX · Standalone

No exports in v1.0.0

hype-herohunt-app does not register any exports of its own yet. Players use the phone app, staff use the commands below, and other resources can read the database tables.

NameTypeSidePurpose
/herospawnCommandServerSpawns heroes next to the admin for testing
/heroclearCommandServerRemoves every active spawn
hype-herohunt-app:server:player-loadedEventServerBinds a player to their collection
hype-herohunt-app:server:player-unloadedEventServerReleases a player's cached data

Commands

Both commands are ox_lib commands restricted to the group.admin ACE group.

/herospawn

Spawns heroes 15 to 60 meters around the admin, at the admin's height. Use it to test catching, rarities and tasks without waiting for a spawn round.

/herospawn [hero] [count]
/herospawn hero_049 1
/herospawn random 10

Prop

Type

These spawns skip the ground check and the spawn rules, but they are normal spawns otherwise: every player sees them and they expire after Spawn.DespawnAfterSeconds. The command works in game only, not from the server console.

/heroclear

Removes every active spawn from the world and marks it as expired in the database. Works in game and from the server console.

/heroclear

Events

The framework bridges trigger these events for you. Every request from the app also binds the player on its own, so the app keeps working even if your multicharacter resource fires neither of them.

hype-herohunt-app:server:player-loaded

Binds a player to their collection: the hero_player_data row is created if needed and the discovered heroes are loaded. The bridges trigger it from QBCore:Server:OnPlayerLoaded (QBox and QBCore), esx:playerLoaded (ESX) and playerJoining (standalone). Trigger it yourself if your multicharacter resource loads characters without these events.

server.lua
TriggerEvent('hype-herohunt-app:server:player-loaded', source)

Prop

Type

hype-herohunt-app:server:player-unloaded

The opposite: releases the player's cached data and stops their map stream. The bridges trigger it from QBCore:Server:OnPlayerUnload and esx:playerLogout. Players who leave the server are handled on their own.

server.lua
TriggerEvent('hype-herohunt-app:server:player-unloaded', source)

Server only

These are local server events. Never trigger them from the client.

Framework bridges

The framework bridges in frameworks/ are not escrow protected. The script needs only one thing from your framework: the character id that owns a collection.

main.lua
FunctionReturns
GetPlayerIdentifier(playerId)citizenid on QBox and QBCore, identifier on ESX, the Rockstar license on standalone. nil while no character is loaded

frameworks/main.lua picks the bridge from Framework in the config. Each bridge also forwards its framework's load and unload events to the events above. With Ownership = "account" (and always on standalone), the bridge is not used for the owner: collections belong to acc:<license>.

lb-phone integration

The app uses the lb-phone custom app API. Nothing needs to be set up in lb-phone itself.

WhatHow
App and App Store listingAddCustomApp with the App settings, a second after lb-phone starts. Added again when lb-phone restarts
RemovalRemoveCustomApp when hype-herohunt-app stops
Maplb-phone's built-in GTA map component, with the discovery circle and hero markers on top
ThemeFollows the light or dark theme from the phone settings
Task notificationsSendNotification from the app when a task is completed while the app is not open on screen
DirectionsThe Directions button on a hero sets a GPS waypoint

Internal events

hype-herohunt-app:client:spawns, hype-herohunt-app:client:event and the hype-herohunt-app:server:* callbacks are internal. The server checks every catch, conversion and claim, so calling them by hand does nothing useful.

Reading the data

Every table uses the owner column as the collection key: the character id with Ownership = "character", or acc:<license> with "account" and on standalone. See Database for the table list.

Candy balance and totals of a character
SELECT candy, candy_earned, total_captures, total_converted, tasks_completed
FROM hero_player_data
WHERE owner = 'ABC12345';
Top 10 collectors
SELECT owner, COUNT(*) AS discovered
FROM hero_discoveries
GROUP BY owner
ORDER BY discovered DESC
LIMIT 10;

On this page