Racing scripts for racing fans

Uploaded latest version to GitHub - emtneutrino/races

Video explaining new ‘recur’ and ‘order’ parameters of random vehicle races:

2 Likes

Very useful video, thanks.

This script is great for No Props racing and AI, I love the flexability of the random races features, i may even start using it ago.

A few questions

1.Will your races ever support xml style tracks made with props?
2. Can i take the race results and best times etc and add it to a mysgl database, like I hvae here > https://randomraces.com/results/racing_list.php
3. Any plans to simplify the UI

I remember when You first started with this, it was very good then. It just gets better. Well done for your hard work and continued features etc.

1 Like

It’s crazy how this is still being improved upon :+1:

1 Like

Thanks for liking the scripts.

  1. I don’t know exactly what you mean. Do you mean making the track data into xml and using props like a stack of tires or a cone instead of checkpoints?
  2. I could probably create a CSV or JSON file with the results. Maybe have a field saying the racer is human or AI or a separate file for only human racers.
  3. What kind of simplifications are you thinking about?
  1. I mean Like community races, basically loading a map created already, then using your script for checkpoints within that track. I say xml as i use another script that using xml data and lua to race. > [H@mer][GameRoom] Racing (GTA:O Style) + Map Creator

Currently your script is pure racing around the map anywhere, with the function of adding checkpoints and creating a track. (Which is fine)

I can load tracks with a script, then add your checkpoints to that track, but then I would have to keep offloading the track.

basically what im saying is your script with any premade track.

  1. That would be good if you could

  2. I have always thought the UI was very complicated, could you not use Native UI Or Rage style Menu for UI. I also find it irritating because its always centered and obstructing most of screen, just my constructive thoughts.

  1. Supporting xml tracks with props looks like a huge amount of work(I might be wrong). I’m probably not going to support it any time soon. Also, what do you mean by “I would have to keep offloading the track”?
  2. I’ll create a JSON file of the results in addition to the results_[name].txt file unless you don’t need the results_[name].txt file. I believe I created the results_[name].txt file at your request. If you only need the JSON file, I’ll get rid of results_[name].txt.
  3. Switching to Rage UI also looks like a big amount of work. One of my goals was not to depend on other resources(except chat). The aim of the UI is to support all possible chat commands, which does make it more complicated.
  1. I have a custom script (object loader) to load and unload any track xml map from spooner or map editor file, once loaded i can add checkpoints from you script, thus this way it will be a custom map an not just checkpoints.

Thats what I mean by off loading or keeping them there.

  1. The more flexable this is for as many results table the better

  2. I understand the amount of work, sometimes you have to bite the bullet. Yes there are so many chat commands, why to many in my opinion, and I have to keep a cookbook of commands.

I understand you want to keep it as personal as possible, but if you want to move forward to a even more fantastic script, that’s of course down to how you want it to develop.

Again great work so far

Streamed a bit racing Froggers in an air map.
Did not have an AI list, so spent some time setting that up too.

1 Like

Thanks for using the scripts and recording a video.

FYI, I believe you are using an older version of the scripts. When you deleted uno before spawning the vehicle for it, there is a bug where you saw “Ignoring leave event”. I fixed that in the latest version of the scripts.

The command to delete all AI is ‘/races ai deleteAll’, but you do not have to do this to change the vehicles the AI are in. You can just type ‘/races ai spawn alpha frogger’ to change the vehicle instead of deleting, adding and then spawning.

I’m considering combining the AI add and spawn commands so you only need to add the AI and specify the vehicle model, then move out of the way and when you are far enough from the location you added it, the vehicle spawns. The spawn command will be used to change the vehicle the AI is driving.

I found a bug in the latest uploaded code where you cannot create a race with the vehicle class being -1, which uses a custom list of vehicles racers can pick from. I’ll fix it in the next upload.

1 Like

Latest version of scripts uploaded to GitHub

CHANGE NOTES

  • 2024-03-29
    • races_client.lua
      • removed ‘/races ai add [name]’ command
      • removed ‘addAIDriver’ function
      • added ‘coord’ and ‘heading’ arguments to ‘spawnAIDriver’ function
      • player adds and spawns AI driver using ‘/races ai spawn [name] (vehicle)’ command
        • player must move away from where AI driver was added for ped and vehicle to spawn
      • if player attempts to spawn AI driver, but fails because some restriction is not satisfied(vehicle or vehicle class), AI will be added without a ped and vehicle spawning
        • ‘/races ai list’ command will show AI driver without a vehicle
      • if player types ‘/races ai loadGrp [access] [name]’, AI driver ped and vehicle will not spawn if player is too close to where AI driver would spawn
        • ‘/races ai list’ command will show AI driver without a vehicle
        • player must move away for AI driver ped and vehicle to spawn
      • player can change AI’s vehicle using ‘/races ai spawn [name] (vehicle)’ command
      • fixed bug where player is unable spawn AI or load AI group in ‘Custom’(-1) class races
        • aiState.drivers[name].raceVehicleList was nil when ‘spawnAIDriver’ function was called
      • fixed bug where AI drivers calculated current waypoint incorrectly if player’s ‘startIsFinish’ value is different than ‘aiState.startIsFinish’
        • was using ‘startIsFinish’ instead of ‘aiState.startIsFinish’
        • fix was to use ‘aiState.startIsFinish’ instead of ‘startIsFinish’ to calculate current waypoint
      • fixed bug where finish event was not triggered by server if player joined race, then left before start delay expired
        • ‘bestLapVehicleName’ was nil before start delay expired
        • server ignored finish event because ‘vehicleName’ argument was nil
        • results event would not be triggered by server
        • race would not be deleted on server and player would not be able to register another race
          • player would have to unregister race as work around for problem
        • fix was to set ‘bestLapVehicleName’ before start delay expired
      • fixed bugs where finish and results events were not caught by client if player joined race, then left before start delay expired
        • leaving would set ‘raceIndex = -1’ prematurely and finish and results events were not caught because ‘rIndex’ did not equal ‘raceIndex’
        • fix was to set ‘raceIndex = -1’ only when results event was caught
      • changed combined start/finish waypoint color to orange
      • changed current waypoint blip color to yellow so racer knows which blip is current waypoint
      • print model and long name of vehicles in ‘listVeh’ function
    • races_server.lua
      • modified ‘saveResults’ function so results are saved as JSON file instead of text file
    • index.html
      • removed ‘ai_add’ button
    • index.css
      • removed ‘ai_add’ style
    • index.js
      • removed ‘ai_add’ click function
2 Likes

Latest version, unable to start, frozen here:

I typed /races start 12 and it went to this screen. No countdown.
FiveM client 7788 windows server artifact 7819

Nevermind, went back to an older windows artifact server and it works fine, just not in 7819, also no peds or other vehicles in 7819.

Do you see any errors in the F8 client console or the server console in artifact 7819? I use the latest recommended artifact (7290) to test the scripts.

No, nothing in the F8 console and no errors in the server logs. I only went to 7819 because TXAdmin DIscord said to upgrade to it for its scripts, I may go higher tomorrow. 7617 works fine.

Latest video with the latest scripts and server windows artifact 7617 working just fine.

1 Like

Nice video!

Nice Idea, however, you couldnt really have a proper agrassive race. The Ai’s are just like sheep on a track.

I think that would be good to showcase something, but in my view its not racing.

Better off doing it wirh Sim racing, like I use AMS2 with AI’s are fantastic. Also tracks are all built with fantastic tracks, circuits.

Can i ask how are you planning on using the AI’s for? as clearly there is no competition , i mean easy to beat always.

hope you don’t take it personally, as it’s just an observation.

I can see no fun factor at all…

Everyone’s idea of fun is different. Someone could find racing with slow AI is fun and others would say it’s boring. Basketball, football, soccer, car racing, sky diving, reading books, dancing is fun or boring to someone. Not everyone’s idea of fun is the same. Someone could like the scripts I made or they could hate them. You get the idea.