Hey, I have a problem with C# script, whatever I do always have ≈5% Time and ≈0.04 ms. Even if my scrypt is empty ( just the code Debug.WriteLine(“hello world”); ).
For three days, he has been trying to find a solution, but without success. I tried use Mono rt2, but it didn’t help.
Anyone have any ideas what I’m doing wrong in my code?
My project: GitHub - mikoslaf/c_follow
You are not doing anything wrong. If I am not mistaken it is because of loaded CitizenFX library.
1 Like
Are you sure you properly used mono_rt2?
With the base c# runtime (mono_rt2 shouldn’t have this) you’re going to always have 0.04-0.05ms overhead from the actual runtime
I think so too, but I saw the script with 0.0 Time and 0.0 ms like this GitHub - randomsean/RS9000: FiveM Police Radar System
You know how people do it? I think he didn’t use mono_rt2
I 10 times, tiried use mono_r2 and I always have some results. I have the same time as always or my script just doesn’t do anything. Maybe I just don’t know how to use mono_rt2.
This is my project, but with mono_rt (this doesn’t do anything) GitHub - mikoslaf/c_follow_mono_v2
I did everything step by step as it is written here.
⚠️ This environment is still in beta, crashes and future changes are to be expected ⚠️
# Set up your C# solution
This guide expects that the reader already knows how to work with Visual Studio and how to [set up and distribute FiveM resources](https://docs.fivem.net/docs/scripting-manual/introduction/).
1. Create the solution and projects
* CLI, automatic:
```cmd
dotnet new sln -o MySolution
chdir MySolution
dotnet new classlib --target-framework-override net452 -o Client
dotnet new classlib --target-framework-override net452 -o Server
dotnet sln add Client Server
xcopy %localappdata%\FiveM\FiveM.app\citizen\clr2\lib\mono\4.5\v2\Native\CitizenFX.FiveM.Native.dll Client\bin\ /Y /I
pause
```
\* Higher Framework versions are possible, but Visual Studio may complain on some systems.
* Manual:
Create a new C# **Class Library (.NET Framework)** and add another project in the solution for the missing server or client, also copy **Native/CitizenFX.FiveM.Native.dll** with your client project.
2. Go into your \<MySolution\> directory and open the solution
3. In Visual Studio you right click the project and *Add -> Add Assembly Reference...*
This file has been truncated. show original
Can you show your fxmanifest.lua
?
Of course, this is fxmanifest.lua from my basic code:
fx_version 'bodacious'
game 'gta5'
ui_page 'nui/index.html'
files {
'nui/index.html',
'nui/follow.js',
'nui/style.css'
}
client_script 'Client/bin/Release/net452/publish/c_follow.Client.net.dll'
This is fxmanifest.lua when, I tried use mono_rt2:
fx_version 'cerulean'
game 'gta5'
rt2 'on'
ui_page 'nui/index.html'
files {
'nui/index.html',
'nui/follow.js',
'nui/style.css'
}
client_scripts {
'CitizenFX.Core.dll',
'CitizenFX.FiveM.Native.dll',
'CitizenFX.FiveM.dll',
'c_follow_mn2.net.dll'
}
I tried using clr or mono_rt2 instead of rt2.
Please see #6 on the setup you’re not properly setting the mono_rt2 variables.
1 Like
This working, I didn’t expect to have to give such an inscription there. Thanks
(but now I have a lot of errors, I will work on it )