Racing scripts for racing fans

I think you are the second person to request this. I’ll go ahead and take a stab at it.

Added checkpoints that indicate direction of next checkpoint. Fixed bug that sent position events to racers who already finished their race. Latest version at link in original post.

1 Like

You’re really awesome. It’s the best race script I’ve tested.

1 Like

Bugs fixed: Register races created before player joined server. Handle cases where player drops from server.

1 Like

Best script man , idk if you can but maybe work on the UI Next , would be really cool
An example from another script: Nation - 𝙍𝙪𝙣𝙣𝙞𝙣𝙜 - vRPEX - YouTube

Added ability to export/import single races through server console commands. Latest version at link in original post.

1 Like

I have a suggestion, is it feasible to place participants at the start of the race ?

The registration point is at the start of the race. In order for a participant to join the race, they must be close to the registration point/start of the race. Once they have joined the race, they should line up at the starting point and wait for the person who registered the race to start the race. Ideally, the person who registered the race will tell the particpants to line up right before starting the race. When the person who registered the race starts the race, all participants will need to go through the starting point. Having it done this way should encourage participants to already be close to the starting point. The latest version does it this way. Older versions did not require participants to go through the starting point.

I didn’t explained well what I want, sorry english isn’t my main language.
I asked about positioning participants already registered when the race is started, like in a real life race grid pattern.

1 Like

If I understand you correctly, you would like to have the participants automatically lined up in a grid pattern(for example, 2 wide) as soon as the person who registered the race starts the race. That would require determining who goes in front of who. Since there is no way to determine who goes in front of who, it would have to be random placement in the grid. Some people might object or think it is unfair to have another person in front of them for some reason. For example, the person might be too slow or inexperienced and may block the racers behind them. I’d rather let the participants decide between themselves the order in which they line up in the grid pattern.

Yes it’s exactly what I meant and you’re right for the random aspect I tough about that too.Maybe a configuration that let everyone chose the preferred behavior. But maybe it’s a lot of work I have no idea and it’s already great like this anyway.

Even with a configuration, the lining up behavior would still have to be random. There is no way to determine the order. You could let everyone race around the track by themselves for one lap and record their times(a time trial). Then you can start the race over with everyone lined up in the order of fastest to slowest.

A sound is now played when a racer passes a checkpoint in the latest version at the link in the original post.

Bug fixed: Unfreeze vehicle if race started and racer leaves race before start delay expires.

Thank you!!!

how do i increase the radius on te checkpoints?

In races_client.lua, there is a function called ‘makeCheckpoint’ that creates all the checkpoints. Inside the function is a native function called ‘CreateCheckpoint’ that does the actual creation.

local checkpoint = CreateCheckpoint(checkpointType, coord.x, coord.y, coord.z, nextCoord.x, nextCoord.y, nextCoord.z, 10.0, color.r, color.g, color.b, alpha, num)

The value ‘10.0’ is the radius I set the checkpoints to.

There is another native function inside ‘makeCheckpoint’ that sets the height of the checkpoint called ‘SetCheckpointCylinderHeight’.

SetCheckpointCylinderHeight(checkpoint, 10.0, 10.0, 10.0)

The second parameter is the height of the cylinder when inside the radius. The third parameter is the height of the checkpoint when outside the radius. The fourth parameter is the radius of the checkpoint.

Line 1372 checks the player’s distance from the checkpoint to determine if the checkpoint has been reached by the player:

if #(GetEntityCoords(player) - vector3(waypointCoord.x, waypointCoord.y, waypointCoord.z)) < 10.0 then

If the player’s distance to the checkpoint is less than the value ‘10.0’ then the player has reached the checkpoint.

I believe those are the only values you need to change.

1 Like

‘makeCheckpoint’ is also used to create the registration checkpoint and the checkpoints used while editing waypoints. If you change the radius in ‘makeCheckpoint’ it will change all checkpoint radii.

1 Like

Nice!! this race scrip is awsome dude!

1 Like

hey do i increase the checkpoint Proximity? and also increase the sound of the checkpoint audio, it’s pretty low.

1 Like