Racing scripts for racing fans

@emtneutrino It’s been a while. Merry Christmas bro.

Thanks, Merry Christmas to you, too!

1 Like

script only works if i put another resources folder in my resources folder :thinking:

You gotta make sure it’s in the actaul resource folder.

What is the path to the "races\" folder on your server?

For my setup, I followed Setting up a server using txAdmin - Cfx.re Docs. The path to my "races\" folder is "C:\FXServer\txData\CFXDefault_XXXXXX.base\resources\races\".

I haven’t set up a server using Zap hosting, but there should be one "resources\" folder that you put the "races\" folder under.

Have a look at Introduction to resources - Cfx.re Docs

1 Like

C:\Users\bob12\Desktop\FXServer\txData\CFXDefault_CBB1A0.base\resources\races im hosting on my own pc script doesnt work untill races folder is in another resources folder that is in resources folder :face_with_monocle:

I’m assuming you followed the INSTALLATION instructions of the README.md carefully:

INSTALLATION

Setting up a server: Setting up a server - Cfx.re Docs

Create a races/ folder under your server resources/ folder. Place fxmanifest.lua, races_client.lua, races_server.lua, port.lua, raceData.json and vehicles.txt in the resources/races/ folder. Create an html/ folder under your server resources/races/ folder. Place index.css, index.html, index.js and reset.css in the resources/races/html/ folder. Add ensure races to your server.cfg file.

Do you need something like:
"C:\Users\bob12\Desktop\FXServer\txData\CFXDefault_CBB1A0.base\resources\resources\races\"
to get it running?

What is the path to your FXServer.exe?
For my setup the server executable is: "C:\FXServer\server5402\FXServer.exe"

1 Like

"C:\Users\bob12\Desktop\FXServer\txData\CFXDefault_CBB1A0.base\resources\resources\races\" yes and
C:\Users\bob12\Desktop\FXServer\server

1 Like

Do you see any errors in the server console when you start the server? If so, can you post an image of the console showing the first couple of errors?

If you don’t see errors in the server console, in your client, type ‘t’ to enter into chat mode, then type ‘/races list pub’. You should see a list of the public tracks in the chat window. If you see errors in the server console or the client console(press F8 to show console in client), can you post images of the first couple of errors of both consoles if there are any?

weird it works now normally after “reinstaling” it

@emtneutrino Hey are you still working on this script?

Yeah, I’m modifying some code, but there won’t be anything that will function noticably differently from before. I’m thinking about making some how to videos. I don’t know if anyone would care.

2 Likes

Found a bug that prevents loading an AI group.

Im not sure if i did something wrong or its a bug but ai spawns on me not like in video

Ahhh, I was wondering why they weren’t loading in, so i had to keep adding and spawing.

You first add an AI which will have your coordinates and heading at the time you added the AI. You need to move away from that coordinate and then spawn the AI. If you stay where you are after adding the AI and then spawn the AI, it will spawn on top of you.

you gotta add in the area you parked, then move when your about to spawn.

@emtneutrino Oh yea, did some tweaking to the ai’s. So they can now driving properly, but the only problem i have is that they’re locked to a specific speed.

Direct from the docs:

TaskVehicleDriveToCoord(
	ped --[[ Ped ]], 
	vehicle --[[ Vehicle ]], 
	x --[[ number ]], 
	y --[[ number ]], 
	z --[[ number ]], 
	speed --[[ number ]], 
	p6 --[[ Any ]], 
	vehicleModel --[[ Hash ]], 
	drivingMode --[[ integer ]], 
	stopRange --[[ number ]], 
	p10 --[[ number ]]
)

info about driving modes: HTTP://gtaforums.com/topic/822314-guide-driving-styles/  
---------------------------------------------------------------  
Passing P6 value as floating value didn't throw any errors, though unsure what is it exactly, looks like radius or something.  
P10 though, it is mentioned as float, however, I used bool and set it to true, that too worked.  
Here the e.g. code I used  
Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, Ped, Vehicle, Cor X, Cor Y, Cor Z, 30f, 1f, Vehicle.GetHashCode(), 16777216, 1f, true);  

Speed is the 6th argument which I set to 70.0. The actual speed, from observation, is around twice the value which is 140.0. You can experiment and try other values.

1 Like

Still doing some testing to try finding other bugs, like the bug with loading AI groups, before uploading the fix to github.

3 Likes