LapTimer 1.0
16
1
16
1
Lap Timer Script for any circuit.
Context
A week ago, I was looking for a mod or script to automatically time hot laps. The best one I found was Race Timer (https://www.gta5-mods.com/scripts/race-timer), but it's broken... so I had no choice but to create my own script.
I tried to compile it but couldn't.
Requirements
Script Hook V (https://dev-c.com/gtav/scripthookv/)
ScriptHookVDotNet (https://github.com/scripthookvdotnet/scripthookvdotnet-nightly/releases)
Installation
1. Extract timer.cs into your scripts folder.
2. By default, it is set up for the Nurburgring Nordschleife circuit (https://www.gta5-mods.com/maps/nurburgring-nordschleife-circuit-hq). To configure another circuit, simply modify the coordinates on line 9 with the finish line coordinates of another circuit or location you want to be the finish line. Do not remove the 'f'.
On the next line, you can also adjust the tolerance, which defines the length of the finish line (I believe it's not a line, but a circle or sphere).
Usage
To start timing laps, cross the circuit's finish line, which, as mentioned before, corresponds to the coordinates on line 9 of the script. When you cross, a notification will appear indicating that the lap has started, and the elapsed time will be displayed as subtitles.
When you cross for the second time, another notification will appear indicating the lap has finished along with the time, and the next lap will start immediately. This will loop continuously.
To stop the timer and cancel the lap, press the "N" key, and the script will not activate again until you cross the finish line.
N: Cancel lap.
Tip
Notifications disappear quickly, but you can check the latest lap times in the Pause Menu > Brief > Notifications. I have a version that writes the lap times to a .txt file, which I'll release if people request it.
Conclusion
That's it. It's a very basic script, I know, it's the first one I've made for GTA 5, but I plan to improve it a bit more, like saving lap times and other data to a .txt file, supporting multiple circuits, and... well, I can't think of anything else for now.
If you find a bug, have an idea or want to help, leave a comment, and I'll reply when I see it xddd
Context
A week ago, I was looking for a mod or script to automatically time hot laps. The best one I found was Race Timer (https://www.gta5-mods.com/scripts/race-timer), but it's broken... so I had no choice but to create my own script.
I tried to compile it but couldn't.
Requirements
Script Hook V (https://dev-c.com/gtav/scripthookv/)
ScriptHookVDotNet (https://github.com/scripthookvdotnet/scripthookvdotnet-nightly/releases)
Installation
1. Extract timer.cs into your scripts folder.
2. By default, it is set up for the Nurburgring Nordschleife circuit (https://www.gta5-mods.com/maps/nurburgring-nordschleife-circuit-hq). To configure another circuit, simply modify the coordinates on line 9 with the finish line coordinates of another circuit or location you want to be the finish line. Do not remove the 'f'.
On the next line, you can also adjust the tolerance, which defines the length of the finish line (I believe it's not a line, but a circle or sphere).
Usage
To start timing laps, cross the circuit's finish line, which, as mentioned before, corresponds to the coordinates on line 9 of the script. When you cross, a notification will appear indicating that the lap has started, and the elapsed time will be displayed as subtitles.
When you cross for the second time, another notification will appear indicating the lap has finished along with the time, and the next lap will start immediately. This will loop continuously.
To stop the timer and cancel the lap, press the "N" key, and the script will not activate again until you cross the finish line.
N: Cancel lap.
Tip
Notifications disappear quickly, but you can check the latest lap times in the Pause Menu > Brief > Notifications. I have a version that writes the lap times to a .txt file, which I'll release if people request it.
Conclusion
That's it. It's a very basic script, I know, it's the first one I've made for GTA 5, but I plan to improve it a bit more, like saving lap times and other data to a .txt file, supporting multiple circuits, and... well, I can't think of anything else for now.
If you find a bug, have an idea or want to help, leave a comment, and I'll reply when I see it xddd
Először Feltöltve: 1 napja
Utoljára Feltöltve: 18 órája
Utoljára Letöltött: 31 perce
7 Hozzászólás
Lap Timer Script for any circuit.
Context
A week ago, I was looking for a mod or script to automatically time hot laps. The best one I found was Race Timer (https://www.gta5-mods.com/scripts/race-timer), but it's broken... so I had no choice but to create my own script.
I tried to compile it but couldn't.
Requirements
Script Hook V (https://dev-c.com/gtav/scripthookv/)
ScriptHookVDotNet (https://github.com/scripthookvdotnet/scripthookvdotnet-nightly/releases)
Installation
1. Extract timer.cs into your scripts folder.
2. By default, it is set up for the Nurburgring Nordschleife circuit (https://www.gta5-mods.com/maps/nurburgring-nordschleife-circuit-hq). To configure another circuit, simply modify the coordinates on line 9 with the finish line coordinates of another circuit or location you want to be the finish line. Do not remove the 'f'.
On the next line, you can also adjust the tolerance, which defines the length of the finish line (I believe it's not a line, but a circle or sphere).
Usage
To start timing laps, cross the circuit's finish line, which, as mentioned before, corresponds to the coordinates on line 9 of the script. When you cross, a notification will appear indicating that the lap has started, and the elapsed time will be displayed as subtitles.
When you cross for the second time, another notification will appear indicating the lap has finished along with the time, and the next lap will start immediately. This will loop continuously.
To stop the timer and cancel the lap, press the "N" key, and the script will not activate again until you cross the finish line.
N: Cancel lap.
Tip
Notifications disappear quickly, but you can check the latest lap times in the Pause Menu > Brief > Notifications. I have a version that writes the lap times to a .txt file, which I'll release if people request it.
Conclusion
That's it. It's a very basic script, I know, it's the first one I've made for GTA 5, but I plan to improve it a bit more, like saving lap times and other data to a .txt file, supporting multiple circuits, and... well, I can't think of anything else for now.
If you find a bug, have an idea or want to help, leave a comment, and I'll reply when I see it xddd
Context
A week ago, I was looking for a mod or script to automatically time hot laps. The best one I found was Race Timer (https://www.gta5-mods.com/scripts/race-timer), but it's broken... so I had no choice but to create my own script.
I tried to compile it but couldn't.
Requirements
Script Hook V (https://dev-c.com/gtav/scripthookv/)
ScriptHookVDotNet (https://github.com/scripthookvdotnet/scripthookvdotnet-nightly/releases)
Installation
1. Extract timer.cs into your scripts folder.
2. By default, it is set up for the Nurburgring Nordschleife circuit (https://www.gta5-mods.com/maps/nurburgring-nordschleife-circuit-hq). To configure another circuit, simply modify the coordinates on line 9 with the finish line coordinates of another circuit or location you want to be the finish line. Do not remove the 'f'.
On the next line, you can also adjust the tolerance, which defines the length of the finish line (I believe it's not a line, but a circle or sphere).
Usage
To start timing laps, cross the circuit's finish line, which, as mentioned before, corresponds to the coordinates on line 9 of the script. When you cross, a notification will appear indicating that the lap has started, and the elapsed time will be displayed as subtitles.
When you cross for the second time, another notification will appear indicating the lap has finished along with the time, and the next lap will start immediately. This will loop continuously.
To stop the timer and cancel the lap, press the "N" key, and the script will not activate again until you cross the finish line.
N: Cancel lap.
Tip
Notifications disappear quickly, but you can check the latest lap times in the Pause Menu > Brief > Notifications. I have a version that writes the lap times to a .txt file, which I'll release if people request it.
Conclusion
That's it. It's a very basic script, I know, it's the first one I've made for GTA 5, but I plan to improve it a bit more, like saving lap times and other data to a .txt file, supporting multiple circuits, and... well, I can't think of anything else for now.
If you find a bug, have an idea or want to help, leave a comment, and I'll reply when I see it xddd
Először Feltöltve: 1 napja
Utoljára Feltöltve: 18 órája
Utoljára Letöltött: 31 perce
@Antthony_12
You stated you couldn't compile this script? I'm assuming you're using an old script or tutorial, or more likely AI. If the latter please be aware that the chat AI models (ChatGPT or other) didn't have the best learning resources for SHVDN and consequently Chat AI often invents its own methods and properties. I'm a big fan of AI, as in Stable Diffusion, but it is not the best way to script GTA V.
Since your script is not compiled - the code is exposed- i'm assuming it's both proper and ethical to review it. Most importantly, I hope you don't mind these suggestions and the reason your code isn't compiling yet still working:
You should be using the latest version of SHVDN if you're uploading mods.
For your directives you have choices:
using GTA.UI; //For notification and Subtitles
using Screen = GTA.UI.Screen; //For Subtitles
For notifications, depending on your directives:
Notification.PostTicker("Lap started!",true); //was Notification.Show
For ShowSubtitle, depending on your directives:
GTA.UI.Screen.ShowSubtitle("Elapsed time: " + formattedTime);
or
Screen.ShowSubtitle("Elapsed time: " + formattedTime); // based on your directives
@JohnFromGWN Thanks for your suggestions, I'm not going to bother you if you want to help me, in fact, I appreciate all help since I've never programmed in C# and even less for GTA 5. You caught me, the script was made by chatGTP ^^'.
Thanks to the code you've posted, it seems that it now runs with ScriptHookVDotNet3 and not 2 and that makes the warning that version 2 is deprecated not appear.
I'm using the latest version of SHVDN Nightly.
Regarding compiling it, I've managed to do it with net9.0.200 but SHVDN returns:
[17:08:22] [DEBUG] Loading assembly timer.dll ...
[17:08:22] [ERROR] Failed to load script assembly timer.dll when searching for script types because there is an assembly that the script tried to load as a dependency but couldn't. Exception message: One or more required types cannot be loaded. Retrieve the LoaderExceptions property for more information.
First LoaderException message (which tells what assembly is missing): System.IO.FileNotFoundException: Cannot load file or assembly 'System.Runtime, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Compiling it with net8.0 directly SHVDN ignores the script. So here I am stuck again.
@Antthony_12 There is nothing wrong with using Chat AI. However there are caveats. The learning models use whatever code they can find and most of it is outdated. As a result, the code it generates often is also outdated and the worst of it is that it will invent properties and methods. I haven't compiled your code and I really don't understand why SHVDN would generate such errors. I just spotted your errors in the text. I also use a timer, when I test for stability, and have never encountered such errors. When I have a chance, I'll compile your code and report back.
Finally, in passing, not all code will run uncompiled (for example LemonUI) and if you do use uncompiled scripts the convention is to use .3.cs, for example myscript.3.cs when using SHVDN3.
@Antthony_12 P.S. Are you using VS to compile? Either way, compile with .NET Framework 4.8
@JohnFromGWN Thank you very much, I will keep trying.
@Antthony_12 I can't reproduce your errors. I mean from the log it's very clear that your compiler can't find the necessary assemblies/references. Without knowing what IDE and/or C# compiler you're using I can't comment further. If you do use VS and I strongly recommend it, you will need to add the reference, whether they be System or mod libraries such as SHVDN, nativeui, lemonui, ifruit...etc.
@JohnFromGWN Yes, I'm using VS code and Net9.0, tomorrow I'll try .Net Framework 4.8.1 for devs. The libraries I use are SHVDN and System.windows.forms.dll (from net9.0) I haven't put anything else in the .csproj file, then a dotnet build and it compiles with a warning about the keys