HZ Scripts

Event sources

Every source feeds the same server core (create → settle) behind a generic fixtures abstraction. The core never knows whether an event came from a real API or from your imagination — odds are always generated by HZ-Bets, never imported.


ESPN — all sports, keyless

Config.Sources.espn pulls ESPN's public scoreboard for every configured league: NBA, WNBA, MLB, NHL, NFL, UFC, and worldwide football (Premier League, La Liga, Ligue 1, Bundesliga, Serie A, MLS, Brazil, Mexico…). Football becomes a 1/X/2 market; every other sport a 2-way Winner.

It auto-creates upcoming fixtures, streams the live score, and auto-settles on the real result. Each league is one config line:

Leagues = {
    { sport = 'basketball', league = 'nba' },
    { sport = 'baseball',   league = 'mlb' },
    { sport = 'hockey',     league = 'nhl' },
    { sport = 'football',   league = 'nfl' },     -- American football
    { sport = 'mma',        league = 'ufc' },     -- per-fight on a card
    { sport = 'soccer',     league = 'eng.1' },   -- Premier League
    -- … add / remove freely
}

Off-season leagues simply return nothing; in-season ones fill the board automatically.

Unofficial endpoint. ESPN's scoreboard is public and keyless but undocumented — ESPN gives no guarantee and could change it. HZ-Bets degrades gracefully: a bad / empty / unexpected response does nothing (it keeps serving the last-known board and never settles on bad data). If ESPN ever changes its format, live updates pause until a script update — bets are never corrupted. It is opt-in by design (Config.Sources.espn.Enabled).

How it settles: the score is the source of truth (the winner flag only ever vetoes a disagreement), and an event only settles on a clean, played final — never on a postponed / abandoned game.


OpenLigaDB — football, ODbL

Config.Sources.openligadb is a keyless, no-auth, open football feed (https://api.openligadb.de). List leagues as shortcut or shortcut/season (wm26/2026 for the World Cup, bl1/2025, dfb…). It auto-creates the configured markets with real team crests, auto-settles on the final score, and publishes the league's top scorers ("Top des Buteurs").
Attribution (ODbL). When OpenLigaDB is enabled the UI shows a "Données de match : OpenLigaDB · ODbL 1.0" credit. Keep it — it is required by the Open Database License.

In-play fixtures are polled on a faster cadence for live scores and fast settlement.


RP — admin-created events

The RP source has no external dependency: you create events by hand from the in-game admin screen — races, fights, fictional matches, anything — for any sport, with your own outcomes and odds. This is also how you create a bettable scorer (Buteur) market (admin picks who scored). See Markets & odds.


Graceful degradation

All API work is server-side only and cached; the client never calls an API. A source that returns garbage or goes down can never crash the resource, create a malformed event, or mis-settle a bet — it simply stops updating until it recovers. Already-created events stay visible (last-known board) the whole time.