Racing scripts for racing fans

I posted previously about where the proximity of the player to a checkpoint is checked. I’ll post here again:

As for the volume of the sound when passing a checkpoint, I don’t believe there is a way to increase the volume programmatically. There may be an option to turn up sound effects in the game options. I haven’t checked. Good luck with your changes.

1 Like

thanks again for your help! this script is very great for my racing server i’m trying to build :+1:

1 Like

First of all. Very nice script!

But i keep getting the Error opening file ./resources/races/raceData.json for write. message.

How do I fix it :slight_smile:

I suspect you may have downloaded the files as ‘races-main.zip’ and extracted it to your ‘resources/’ folder and ended up with the files in ‘resources/races-main/’. The scripts are looking for the ‘raceData.json’ file in ‘resources/races/’. The solution is to rename ‘resources/races-main/’ to ‘resources/races/’.

Nope, I have renamed it.
There is no problems to find the 00 - 05 saved files
But I cant save new ones

When i Try save it say the Error open for write + Error saving “Savename” No results.

Could you show an image of your file explorer showing where your files are located? Specifically show where your ‘raceData.json’ file is located.

Also are you trying to export a race from the server console or are you trying to save waypoints you created to your private list of races or to the public list of races?

Please show images of your error messages, too please.

I Have it in my resource folder like where it should be placed.
Not in resource/other or some.

I Try to create a new race, Set the checkpoints and stuff all works…
When I try to save the races it tells me the two errors.
(Error open for write) (Error saving “Savename” No results)

I Have tried to save both public and private but it still says that it cant “Write” in the file. (Not that it cant find it)
If I move the races files then it ofc tell that it cant find the data file. but this is not the error in my case.
races
races2
races3

The only thing I can think of is that the write permissions for that directory are not allowed for the fivem server. Maybe the permissions are set to read only somehow. Maybe install the server in a directory where there are no restrictions on write permissions? It seems to work for other people who have used the scripts.

Could you post an actual image of file explorer where the files are saved?(Showing the whole path, eg. C:\FXServer\txData\CFXDefault_C4256B.base\resources\races)

Are you able to load a public race? For example: ‘/races loadPublic 00’ without error?

Yes I am able to load and drive the public races without error’s
Thats why I was like “What the heck is going on here” :stuck_out_tongue:

I’ve added some extra error reporting in the latest version at the link in the original post. Try doing the same thing again (creating and saving a race) and there should be some extra error info in the error message. Please try again and post an image of the error message.

As a test, I changed the raceData.json file permissions to read only and tried to save a new race. The error message said “savePlayerData: Error opening file ‘./resources/races/raceData.json’ for write : ./resources/races/raceData.json: Permission denied : 13”

If you get the same error, then maybe raceData.json had its permissions set to read only. See if you can change the permissions if this is the case.

Yes I get the Permission denied 13 now.
Im not sure how to change the permissions on the data.json :confused:
perms1
perms2
perms3

I’m using Win10 and this is what I do to change the permissions. Right click on the raceData.json file in file explorer. Click on Properties. At the bottom is the Attributes. There is a check box next to “Read-only” Make sure it is not x’ed and click the OK button. It should now NOT be read only. Try saving a race again.

If “Read-only” is not x’ed, then maybe the directory has some permissions set.

I don’t recognize the properties sheet for raceData.json in the images you posted. What version of Win are you using? I don’t have much experience in other versions of Win.

The pictures before was when I tried to change the permissions through WinSCP
It looks like the permissions change from what they are on my pc when I upload the files.
This picture is from Win10 before upload

So you are uploading the files from your Win 10 PC to a server that runs the fivem server? You’ll need to fix permissions on the server then, which I don’t think I can help you with. I would ask for help from the people that host the server.

Yes, Because I have it hosted by ZapHosting.
Maybe it is Zap that set this kind of permissions I dont know :confused:

If you try to get help from the people that host the server, you should tell them that the fivem server needs permission to write to the raceData.json file in the resources folder.

I Just want to let you know that I am a happy man now :wink:
Perfect timing because we have Race event tomorrow ! ;D

If you want to backup any races you have created, you can make them public, then export the race through the server console. If the race gets deleted from the public list, you can import the backed up race through the server console. Note that anyone can delete a public race. You can also protect the race by saving it to your private list. Only you have access to your private races. Good luck with your server!

1 Like

Added ability to increase/decrease any waypoint radius. Added ability to update previous version of raceData.json and exported races to new race data format which includes waypoint radius.

Don’t know if you saw my latest post. I added the ability to increase / decrease waypoint radius in the latest version.

1 Like