# Street Races

> Time trials on as many tracks as you want, with leaderboards and server-wide record alerts.

- URL: https://xexstudio.com/scripts/street-races
- Resource name: `xex_races`
- Category: Gameplay
- Price: Free
- Frameworks: ESX, QBCore, Qbox
- Source: Open source (no escrow)
- Repository: https://github.com/JGCdev/xex_races
- Version: 1.0.0
- Measured resmon: 0.00 ms idle · 0.01 ms menu open
- Requires: ox_lib, oxmysql, OneSync
- Delivery: instant, through Cfx.re Keymaster
- Documentation: https://xexstudio.com/docs/street-races
- Video: https://www.youtube.com/watch?v=mIdxvVwSfSQ

## Highlights
- Four tracks ready to race and no limit on adding your own, each with its own cars
- Top 10 per track, personal bests and an alert to the whole server when a record falls (on or off)
- The server spawns the car, runs the clock and checks every checkpoint

Walk up to the race desk, pick a track and a car, and race the clock through the checkpoints. Your best time goes on the track's leaderboard, and breaking a record can alert the whole server. Four tracks come ready; add as many as you like.

The server runs every race: it spawns the car, starts and stops the clock and checks each checkpoint against where the car really is. A modified client can't post a time it didn't drive. Free and open source under the MIT license.

## Features
- Race desk with an NPC and ox_target or qb-target, or a marker and [E] without a target resource
- Unlimited tracks: four included, from a city lap to an off-road desert run, and as many more as you add
- 3-2-1-GO countdown, live timer with the checkpoint count and GPS route to the next checkpoint
- Finish screen with your time, your personal best and the track record
- Leaderboard per track with character names, and the number of records each player holds
- Server-wide alert when a track record is broken, which you can turn off in the config
- Ghost mode during races, so racers don't collide with other players
- Optional money for a record, a personal best or a finish, with a cooldown and an hourly limit (off by default)
- Checkpoints checked on the server in order, by position and by plausible speed; one finish per race
- The race car is removed on finish, cancel, death, wreck, leaving it or disconnecting
- /racetool prints new checkpoints and start lines ready to paste into the tracks file
- Hooks and events for battle passes, analytics or job restrictions
- English and Spanish

## Changelog
### 1.0.0
- First public release, tested with real players before release
- Four tracks, countdown, live timer and finish screen
- Leaderboards per track and optional server-wide record alerts
- Server-side timing and checkpoint checks
- Optional rewards, hooks and events
- ESX, QBCore and Qbox, English and Spanish

## FAQ
### Can I change the code?
Yes. It is open source under the MIT license, the whole resource, no escrow. The code is on GitHub at github.com/JGCdev/xex_races.
### How many tracks can I have?
As many as you like. Four come ready to race, and each track you add gets its own leaderboard.
### Can I add my own tracks?
Yes. Drive the route with /racetool to print each checkpoint and the start line, paste them into data/tracks.lua and pick the cars for the track.
### Can players race each other or use their own car?
Not in this version. Every race is a time trial against the clock in a car spawned by the server, so the time can be checked.
### Does it pay players?
Only if you turn it on. Rewards are off by default; when on, they pay for a record, a personal best or a finish, with a cooldown and an hourly limit.
### Can I turn off the record alerts?
Yes. Set Config.Leaderboard.announceRecords to false and only the racer sees the new record.
### Does it need a target resource?
No. It uses ox_target or qb-target if one is running and a marker with [E] if not.
