AI Core

ai-streetraces

Point-to-point street races to a map waypoint with a buy-in, where the first racer at the finish takes the pot.

ai-streetraces lets players start a street race anywhere. A driver sets a waypoint on the map as the finish and picks a buy-in. Drivers nearby get an invitation. After a countdown, the first racer the server sees at the finish takes every buy-in.

What it does in the game

  1. Create. Set a waypoint at least the panel's Shortest race away. In a vehicle, open the radial menu and pick Street race (or type /race), then Race to my waypoint, and type the buy-in. The buy-in is taken from your money account.
  2. Invite. Drivers within the Invitation distance get an invitation. They open the same menu and pick Join (name)'s race within the join time. Joining needs the driver seat and the start line nearby; the buy-in is taken on join.
  3. Start. When the join time ends (or the host picks Start now once two racers are in), racers who are not at the start line in a vehicle are sent out with their buy-in back. With fewer than two racers the race is off and everyone gets their money back.
  4. Countdown. A 5 second countdown; vehicles are frozen. Then Go!
  5. Finish. The finish has a blip and a marker. The first racer the server sees there in a vehicle takes the whole pot.
  6. Time limit. If nobody finishes within the panel's Time limit, the pot is split evenly between the racers still in.

Leaving. Before the start, leaving (or the host cancelling) refunds the buy-in. After the start, giving up or leaving the server loses the buy-in into the pot.

Police. When the countdown starts, the race may alert the police at the start line (panel Alert chance).

Cheating. The server checks each racer's position every 2 seconds. Moving faster than any car can (a teleport) disqualifies the racer; their buy-in stays in the pot. A finish faster than the straight line at 100 m/s is not counted.

Installation

Installed by the AI Core recipe. By hand: ensure ai-streetraces after ensure ai-core. It needs ai-core. No database table, no items.

Panel settings

Admin panel > Street races > tab Settings. Defaults come from data/settings.json. Changes apply to races created after the change.

Money: racers pay the buy-in when they join; the first at the finish takes every buy-in.

SettingWhat it changesUnitDefault
Money accountThe account buy-ins are taken from and prizes and refunds are paid to.cash
Lowest buy-inThe smallest buy-in a player may set; 0 allows free races. 0-10,000,000.$100
Highest buy-inThe largest buy-in a player may set; not below the lowest buy-in. 0-10,000,000.$15,000

Races

SettingWhat it changesUnitDefault
Join timeHow long invited drivers have to join; the host can start earlier. A 5 second countdown follows. 15-300.s45
Racers per raceThe most racers one race takes, the host included. 2-16.8
Invitation distanceDrivers this close to the host get the invitation; racers must stay this close (plus 25 m) to the start. 10-400.m60
Shortest raceThe straight-line distance from the start to the waypoint must be at least this. 100-10,000.m500
Time limitA race nobody finishes in this time ends and the pot is split between the racers still in it. 1-60.min10

Police: alerts go through the alert system ai-core uses.

SettingWhat it changesUnitDefault
Alert chanceThe chance that a race start sends a police alert at the start line; 0 never alerts. 0-100.%25

Commands

CommandArgumentsWho may use itWhat it does
/racenoneeveryoneOpens the street race menu (create, join, start, leave). The same menu as the radial item, for servers without a radial menu.

Keybinds

None. The menu opens from the radial menu (Street race, shown while driving, invited or racing) or with /race.

What it stands in for

No fxProvide. It replaces qb-streetraces / qbx_streetraces (one menu instead of their four commands), without their exports or events.

Compatible scripts

Money goes through ai-core, alerts through the dispatch layer, the menu item through the radial layer. Any alert script and radial menu AI Core supports works (see Compatibility).

Known limits

  • Point-to-point races only: no laps, no saved tracks, no checkpoints.
  • The finish has no height: it is a flat circle around the waypoint.
  • Buy-ins of racers who all left a running race are lost (written to the log).
  • A resource stop refunds each remaining racer their buy-in.
  • Log channel: races.

On this page