Racing scripts for racing fans

Is there a way to add GTA Online’s start camera?

I’m not sure what you mean. Could you explain more and maybe show a picture or video?

1 Like

This person made a racing framework with working GTA Online Race Lineup camera, i wondering if its possible to implement it to your script since someone else already did it with there private script.

Do you mean having the camera move around the car before the start? I’m not sure how to do that. I don’t think it adds very much to the race. If other people request this, I might try to figure out how it’s done.

1 Like

ok cool :+1:

Added ability to make racers start in a specified vehicle in random vehicle races. Respawns put players in new condition vehicles and delete the old vehicle. Respawns can be executed by pressing ‘F’ on keyboard, ‘Y’ on Xbox controller or ‘Triangle’ on DualShock controller for one second.

1 Like

Race results are now saved to resources/races/[owner]_results.txt where [owner] is the owner of the race. Latest version at link in original post.

1 Like

Hey, how can i change the position of the arrow? it’s too high up and can sometime be block by a bridge or trees in certain area.

Do you have the latest version? I lowered the checkpoint heights for everything. If not, then checkpoint heights are set in calls to makeCheckpoint. Here’s the definition:

local function makeCheckpoint(checkpointType, coord, nextCoord, color, alpha, num)

The height is set in the coord argument. Before the call to makeCheckpoint, I set the coord.z value to a number. Higher numbers are higher in height, lower numbers are lower in height. For example:

    local pedCoord = GetEntityCoords(PlayerPedId())
    local coord = {x = pedCoord.x, y = pedCoord.y, z = pedCoord.z, r = 5.0}
    local checkpoint = makeCheckpoint(arrow3Checkpoint, coord, nextCoord, yellow, 127, 5)

You will want to pass a modified copy of coord instead of modifying coord directly and then pass it to makeCheckpoint. For example:

local coordCopy = {x = coord.x, y = coord.y, z = coord.z - 5, r = coord.r}
local raceCheckpoint = makeCheckpoint(arrow3Checkpoint, coordCopy , nextCoord , yellow, 127, 0)

In the above, I made a copy of coord' with a modified height and passed it to makeCheckpoint. In the copy, I decreased the coord.z height by 5.


The variable raceCheckpoint is the yellow race checkpoint you see when racing. These are the ones you want to change the height of. There are only two places where raceCheckpoint is set. You should make a copy of the coord argument passed to makeCheckpoint and change the height. For example, change the following:

raceCheckpoint = makeCheckpoint(checkpointType, waypointCoord, nextCoord, yellow, 127, 0)

to

local coordCopy = {x = waypointCoord.x, y = waypointCoord.y, z = waypointCoord.z - 5, r = waypointCoord.r}
raceCheckpoint = makeCheckpoint(checkpointType, coordCopy, nextCoord, yellow, 127, 0)

I decreased the waypointCoord.z height by 5 in the copy.

Changed respawn key/button to ‘X’ key, ‘A’ button on Xbox controller, ‘cross’ button on DualShock controller.

Hi! First of all, thanks for your awesome work. I’m wondering if there’s any way to copy existing races from other racing script to this one.
Basically, it’s the same coord system but in Lua. Looks like this:image

Is this ESX only?

This should work for most frameworks.

You would have to manually copy the x, y, z coordinates and add an r value(radius). Take a look at the sample races in .json format. If you can copy those into a .json file and then import(read the README.md file on how to import races) you should be able to use the track.

1 Like

Alright! Is it possible to convert races from this form


to something like table or so? It’d be much easier to edit coords this way. There’re many races those have 30+ waypoints :grimacing:

Sorry, no. There is no easy way to do it. You would have to manually copy the coordinates to the format you want it.

1 Like

Hey, it’s me again. I wanted to ask how results are calculated.
Let’s say we have 3 players racing together, sometimes a guy who has 100% the fastest time in the race somehow is displayed in the results like he came to the finish line 2nd, but actually he was 1st - no doubts. Also he gets credits for the 2nd place not for the 1st one.
Maybe I misunderstood how it works but I’d really appreciate any help :slight_smile:

Results are based on the time to finish the entire race. The shorter the time, the higher the place. I was assuming that the time to finish the race would mean that a racer who has a shorter time than another racer would physically finish before the other racer. If that’s not the case then that might mean racers are not starting at the same exact time which I assumed was the case. If you have video evidence of this, could I take a look at it? I might have to rework the timing.

1 Like

I tried to catch this bug today but the thing is it doesn’t appear anymore :flushed: I’ll let you know if it pops up again.
Also sometimes position counter is flickering (changing your position every sec).
I was the 3rd all the time.


image

For part of calculating the position, I use a native function that calculates the travel distance from your current position to the next waypoint. It’s sort of like a GPS distance calculator. Sometimes the function calculates distance using a weird path instead of one that is more direct. If this happens a lot, then I will need to change how to calculate postion. If you have video of this, I’d like to see when it is happening.

1 Like