Racing scripts for racing fans

In reply to
3. There is a popular guy that streams Random car Races example

Each lap a new random car is spawned, its hugely popular and was made by Project homecoming, the link I gave you just shows a guy that uses it a lot.

No one else has done anything like this but is hugely popular.

  1. that would be great if you could

Question 4
So whatever car is chosen to be spawned will be the car of choice for that race.?

The player can use any vehicle they want, even on foot. Don’t know about airplanes or boats though. I added a command that lets the user spawn any car/vehicle they want as long as they know the name. The player would have to look up the names somewhere. I might find a list and add it to the README.md file in the future. If they use the command and don’t specify the car name, the Adder is the default car that spawns.

I’ll take a look at Project Homecoming and see if I think it’s worth adding if I’m capable.

How many places would you like to see instead of the top 10?

Thx for quick reply:

As to how many, would be great to see all those that entered, say I had a race with Max of 32 people, and all finishe i am sure they would all like to know there position for those 32 Entrants.

Back to car spawning, so i cannot set a race with 1 specific car only (If wanted) but also I can have a race with any car user pleases, etc.

You seem very talented so far. Project homecoming with random cars is so mush fan, as it gives as all the ability to win some races even if we are rubbish drivers at times because on some laps if you are given a crap car then your lead decreases etc.

Actually, all players are listed in the results. I thought you were talking about best lap times. Only the 10 best lap times of all time can be listed for a track, but all players that entered a race will be listed in the results, even those that DNF.

Any car/vehicle can be used for races. There are no restrictions. There is no option to limit the type of car to be used in a race. Players can spawn any vehicle they want as long as they know the correct name. Restricting a race to a specific vehicle sounds interesting. I might implement restrictions in the future.

Project homecoming seems like it is based more on luck than on driving skill. The race payouts in my script reward the best drivers the most. It isn’t designed to reward drivers based on luck.

Hello,
Actually I also think it’s about the fun factor, I disagree with luck, I agree with luck on random cars sometimes. I say this as many times i have entered many races and usually end up near the back of pack, no matter what type of race, that too me is not luck.

I am talking more about putting the fun back into racing as well (Random cars) (Limit to a certain car) etc etc. EG: a race with a lawnmower etc (Fun factor) and so on. I understand the reward that you mention.

So A fantastic driver could enter my race with a car they no is almost unbeatable, then another first time racer comes along and has no idea what car to use (This seems a bad way to control a race) as there is no control on car class etc. (Shame)

Anyway thx didn’t realise it shows all entrants results. The script certainly has huge potential and I am continuing to test it’s current features

Project homecoming does sound like fun. I’m thinking if I implement it, it will not give out a race payout and not record best lap times. I also like the one make race idea, but the make will be determined by the person who registers the race. I think I will add the car names list in a separate document so racers can look up car names they want to spawn.

1 Like

This vid just goes to show the fun you can have. Again project homecoming Random case each lap, but it demonstrates how much fun at the 1st lap you can have or not! then its random all the way.

It also demonstrates what fun it would be with a class or car is set by the race director.

So is this random car business hard to implement? & also there tracks are fantastic, would like to know how to make tracks like there’s.

Great idea for the car list etc, although they could google about cars to use etc. And Start on a grid with lights or summin would be a bonus

Added ability to run one make vehicle races. Races can now be restricted to a specific vehicle that racers are allowed to use. Details are in the README.md file. The latest version of the scripts are at the link in the original post.

Hey, excellent thank you for that.

Is there a way to build custom map tracks with CodeWalker and use your script to race these tracks or is there another way to import already made race tracks out there for your script?

The random car business may be harder to implement. My scripts do not let you create tracks like I assume Project Homecoming does. They are limited to just creating waypoints. My scripts don’t have a lot of bells and whistles like a starting grid, lights or real track creation. It started out simple and will most likely remain simple because of my limited skill. The screen shots at the link in the original post are basically what you see is what you get. No complicated interface or features.

Your script is fine, already you have added a lot of features with a great tutorial.

As to tracks, I could add some props to map around where I base the races as an option. I hope that you will be able to figure out some kind of random car race, that is different car per lap

Is there a way I can edit

  1. The colours (Arrows) and Waypoint
  2. Change colour opacity
  3. Move down the direction Arrows, they seem a little high up

4.Also can I edit the display overlay that appears showing laps, wayponts etc above the car also (Position) Colour Background colour

Im pretty good with css but have no idea where the css styles are coming from, once I know I could edit myself

I had lots of issues with txAdmin and this script. I then went and scrapped txAdmin and now everything is fine, no matter what persmissions I change I had lots of issues.

Not sure if that helps but I feel it could be compatibility issues with txAdmin or summin

I’d have to tell you the line numbers where the various things are set. I’ll do that in a later post.

There is no CSS or HTML code used for the display. The CSS and HTML code is used for the ‘/races panel’ command.

1 Like

I don’t know how txAdmin would interfere with the scripts. I thought txAdmin was just used to administer the server. I thought it only starts/stops the server and loads/unloads/restarts resources.

Not saying it was the culprit, what I was saying was it’s that or summin. I assumed it was related to this one way or another or not. I’m saying as soon as I went away from txAdmin no permission issues with saving a race etc, as the user had what issues I was getting.

Strange how it was only happening with txAdmin!

Yes please let us know the lines I can Edit for my other query

Thx

Added new mode of racing where vehicles change every lap, buy-in amounts are set to 0 and there are no payouts. Details are in the README.md file. The latest version of the scripts are at the link in the original post.

1 Like

Your the best, thx… So could it be any car from all cars, or certain class? going to be a late night testing here in the uk

Sorry my bad, I think I answered my own post, I couldn’t find at first the new instructions with random cars.

FOUND IT:

“” If you use rand as the restricted vehicle name, buy-in amounts will be set to 0, there will be no payouts and vehicles will change every lap. If you set the number of laps to 2 or more, the start and finish waypoints must be the same. Instructions on how to do this are listed above. You may only register one race at a time. If you want to register a new race, but already registered one, you must unregister your current race first. You cannot register a race if you are currently editing waypoints. Stop editing first.

If you registered a race where the restricted vehicle name was rand, all vehicles change to random vehicles every lap. Buy-in amounts will be set to 0 and there will be no payouts. For example you may type /races register 500 4 120 rand to register a race with a buy-in amount of 500 which will be set to 0, 4 laps, a DNF timeout of 120 seconds and vehicles will change randomly every lap. The list of possible vehicles that vehicles can change to is read from the file random.txt. You will probably want to add more than there are in the file. Vehicles can be added from the vehicles.txt file. If you want to increase the chances of a specific vehicle to appear, you can enter multiple entries of the vehicle in the file. Blank lines are ignored. If there are invalid vehicles in the file, they will be ignored.

Line numbers below are based on the latest version of the scripts checked in today

question 1 & 2:
line 43: definition of color ‘yellow’

local yellow = {r = 255, g = 255, b = 0}

line 1153: checkpoint color at start of race set to yellow - 4th field

raceCheckpoint = makeCheckpoint(arrow3Checkpoint, waypointCoord, waypoints[2].coord, yellow, 127, 0)

line 1559: checkpoint color after race start set to yellow - 4th field

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

Color opacity of checkpoints is set to 127 in calls to ‘makeCheckpoint’ above, 5th field. Max is 255.

question 3:
lines 62 - 65: checkpoint types

local finishCheckpoint = 9 – cylinder checkered flag
local midCheckpoint = 42 – cylinder with number
local plainCheckpoint = 45 – cylinder
local arrow3Checkpoint = 7 – cylinder with 3 arrows

checkpoint types documented at:CreateCheckpoint - Natives @ Cfx.re Docs

line 179 - 183: I adjusted the height(zCoord) of checkpoints based on type. If it is type 42 or 45, I don’t increase the height. If it is neither, I increase the height by the radius of the waypoint.

local function makeCheckpoint(checkpointType, coord, nextCoord, color, alpha, num)
local zCoord = coord.z
if checkpointType ~= 42 and checkpointType ~= 45 then
zCoord = zCoord + coord.r
end

question 4:
The hud is drawn in lines 1415 - 1470 using ‘drawMsg’ function at line 288

local function drawMsg(x, y, msg, scale)

x and y are percentages. x = 0.0 means all the way left. x = 1.0 means all the way right. Similar for y.

Color of the text is set on line 291 in ‘drawMsg’ function

SetTextColour(255, 255, 0, 255)

Left and right side of hud is set to the following values on lines 77 - 78 used in ‘drawMsg’ calls

local leftSide = 0.43 – left position of HUD
local rightSide = 0.51 – right position of HUD