Racing scripts for racing fans

  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.

Sometimes I race helicopters with these scripts. If there are no obstacles, they are very competitive. I have have fun with them.

Ah ok.