Racing
Player-built race tracks and drag strips, with sprint, circuit, elimination, time trial and drag races. Car classes run from D to X, there are weight brackets for drag, and the start lights are a real drag tree (sportsman and pro) plus a red, red, yellow, green gantry. The server times everything and pays every prize.
#Install
ensure GR1M_Racing
add_ace resource.GR1M_Racing command.add_ace allow
add_ace resource.GR1M_Racing command.remove_ace allow
It needs oxmysql, ox_lib and qbx_core, and creates its tables on start. GR1M_Placer is used for props and lights, GR1MOS_Phone for the phone app, GR1M_UltraBoss (gov) for house money and kartik-mdt for the police alert. Each of these is optional and skipped if it isn't running. The two add_ace lines let a checkpoint reset give the racer ElectronAC's Bypass for 2 seconds while the server moves the car. ox_target is used for kiosks.
#Use
/racing, the Racing phone app, or a racing kiosk (use your target on it): lobbies, host a race or tournament, tracks and records, your rating.- Build a track by driving or walking it. Press E to drop a checkpoint where you are, ↑/↓ to change its width and Backspace to undo. X opens the menu for the finish line, moving/adding/deleting/resizing checkpoints (by standing at them or aiming with GR1M_Placer), moving the start, props, lights, loop, strip length and save. On a drag strip, E sets the start beam at your front bumper (or your feet on foot).
- Finish line: optional. It is saved as the last gate after the checkpoints, drawn with a chequered flag. Without one the last checkpoint is the finish.
- Y (rebindable) resets you to your last checkpoint on official tracks, with a time penalty. Limited per race and by a cooldown (Cheat checks settings).
/racingadmin(acegr1m_racing.adminor the qbxadmin/godgroup): every setting with plain-English help, plus making tracks official, deleting tracks, per-car class overrides, approving or rescoring new cars, placing kiosks (Kiosks tab, uses GR1M_Placer) and stopping live races.
#How it decides things
- Classes: the client works out a score from the model's stat-bar numbers (top speed, acceleration, braking, grip). One report is never trusted: until
classReportsdifferent characters report numbers withinclassAgree%, the model races on the highest score and weight anyone reported (so a modded game can only push a car up). Then the numbers lock. Admin class limits turn the score into D to X. Staff can approve, rescore or override any model in the Cars tab. - Timing: clients report checkpoints and drag splits. The server uses the client's millisecond time only when it is within
clockSlackof the server's own estimate after allowing for ping, and the car really is at that spot. Otherwise it uses its own time. Moving between checkpoints faster thanmaxCpSpeed(straight line, so always below real speed) is a DNF and is printed to the console. - Money: entry fees go into
gr1m_racing_escrowwhen a racer joins, and are refunded if they leave before the start, are not at the start, or the race is cancelled. Anything still held after a restart is paid back when the owner next loads in. Street pots lose the house cut, official races pay the official split, and shares nobody earned go to the winner. - Drag: each car stages by its front bumper (pre-stage, then stage). The tree fires after a random wait once every car is staged. Bracket racing gives the slower dial-in the tree first. A red light, breaking out, and both-broke-out are judged the way real strips judge them. The server watches each car from the moment the tree fires: rolling a metre forward before green is a red light whatever the client reports, and the pass time is the gap between the launch and finish reports as they reach the server.
tests/util_test.lua covers the shared maths (lua tests/util_test.lua from this folder).
#Grid slots
- In the builder (route tracks), X > Grid slots. Stamp the boxes in start order, slot 1 is pole, facing the way the cars leave. Up to 16 (
RacingConfig.MaxGrid), box sizeRacingConfig.Grid. - A sprint, circuit or elimination lobby on a track with 2+ slots only races cars sitting in a box. Boxes show to racers and anyone within 150 m and light green when filled. Pull into an empty box and press E to join (same fee and class checks as the app).
- The race starts when every box is full, when the host presses Start now (needs 2+ boxed), or when the timer runs out. Anyone not boxed then is dropped and refunded.
#Tournaments (Join Tournament tab)
- Host > Tournament: name, type (sprint/circuit/elimination), class, laps, one entry fee for the whole thing, sign-up time, most entrants, and 2-10 rounds (any route tracks, repeats allowed; circuit/elimination need loops).
- Each round opens as a normal lobby that only entrants can join. Entrants get a waypoint and have
tournamentGapseconds (setting, default 90) to get there. On grid tracks each entrant's box follows the standings, leader on pole. - Points per place:
RacingConfig.TournamentPoints(25, 18, 15, 12, 10, 8, 6, 4, 2, 1). DNF or no-show scores 0. Ties: wins, then best finish. - Pot = fees + house prize, paid on the final standings with the official split when every round is on an official track, otherwise the street cut + street split. Nobody scored = everyone refunded.
- Leaving during sign-up refunds; quitting after it starts forfeits the fee. Host cancels during sign-up, staff any time (full refund). Tournaments live in memory: held fees are refunded by the normal escrow rule after a restart.
GR1M