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.
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.
| Name | Type | Side | Purpose |
|---|---|---|---|
/herospawn | Command | Server | Spawns heroes next to the admin for testing |
/heroclear | Command | Server | Removes every active spawn |
hype-herohunt-app:server:player-loaded | Event | Server | Binds a player to their collection |
hype-herohunt-app:server:player-unloaded | Event | Server | Releases 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 10Prop
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.
/heroclearEvents
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.
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.
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.
| Function | Returns |
|---|---|
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.
| What | How |
|---|---|
| App and App Store listing | AddCustomApp with the App settings, a second after lb-phone starts. Added again when lb-phone restarts |
| Removal | RemoveCustomApp when hype-herohunt-app stops |
| Map | lb-phone's built-in GTA map component, with the discovery circle and hero markers on top |
| Theme | Follows the light or dark theme from the phone settings |
| Task notifications | SendNotification from the app when a task is completed while the app is not open on screen |
| Directions | The 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.
SELECT candy, candy_earned, total_captures, total_converted, tasks_completed
FROM hero_player_data
WHERE owner = 'ABC12345';SELECT owner, COUNT(*) AS discovered
FROM hero_discoveries
GROUP BY owner
ORDER BY discovered DESC
LIMIT 10;